const oemEnv = require('./oem.env.json')
const { spawn } = require('child_process')

const argv = process.argv
const env = oemEnv.find((e) => argv.includes(e.VUE_APP_ENV))

if (env) {
    const args = ['vue-cli-service', 'build', ...argv]
    spawn('npx', args, {
        env: {
            ...process.env,
            ...env,
        },
        stdio: 'inherit',
        shell: process.platform === 'win32'
    })
} else {
    console.error('环境变量不存在')
}