fix: ensure correct process.env.NODE_ENV

This commit is contained in:
草鞋没号 2021-11-29 11:33:18 +08:00
parent 1509250f92
commit a02c7c71fe
1 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@ const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8')
function getWatcher({ name, configFile, writeBundle }) { function getWatcher({ name, configFile, writeBundle }) {
return viteBuild({ return viteBuild({
// Options here precedence over configFile // Options here precedence over configFile
mode: process.env.NODE_ENV,
build: { build: {
watch: {}, watch: {},
}, },
@ -46,7 +47,7 @@ async function watchMain() {
electronProcess && electronProcess.kill() electronProcess && electronProcess.kill()
electronProcess = spawn(electron, ['.'], { electronProcess = spawn(electron, ['.'], {
stdio: 'inherit', stdio: 'inherit',
env: Object.assign(process.env, pkg.env), // Why don't work? env: Object.assign(process.env, pkg.env),
}) })
}, },
}) })