|
|
@@ -4,26 +4,11 @@ const { spawn } = require('child_process')
|
|
|
const argv = process.argv
|
|
|
const env = oemEnv.find((e) => argv.includes(e.VUE_APP_ENV))
|
|
|
|
|
|
-if (env) {
|
|
|
- const command = process.platform === 'win32' ? 'npx.cmd' : 'npx'
|
|
|
- // 创建子进程
|
|
|
- const build = spawn(command, ['vue-cli-service', 'build'], { env })
|
|
|
-
|
|
|
- // 监听子进程的输出
|
|
|
- build.stdout.on('data', (data) => {
|
|
|
- console.log(data.toString())
|
|
|
- })
|
|
|
-
|
|
|
- build.stderr.on('data', (data) => {
|
|
|
- console.error(`stderr: ${data}`)
|
|
|
- })
|
|
|
-
|
|
|
- build.on('close', (code) => {
|
|
|
- console.log(`子进程退出,退出码 ${code}`)
|
|
|
- })
|
|
|
-
|
|
|
- build.on('error', (code) => {
|
|
|
- console.log(`编译失败 ${code}`)
|
|
|
+if (env) {
|
|
|
+ spawn('npx', ['vue-cli-service', 'build'], {
|
|
|
+ env,
|
|
|
+ stdio: 'inherit',
|
|
|
+ shell: process.platform === 'win32'
|
|
|
})
|
|
|
} else {
|
|
|
console.error('环境变量不存在')
|