From 0d0037e889e10ee890614180532e78928f3b8290 Mon Sep 17 00:00:00 2001 From: yi-ge Date: Thu, 8 Jul 2021 22:44:44 +0800 Subject: [PATCH] fix main process env bug --- script/build-main.ts | 1 + typings/global.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/script/build-main.ts b/script/build-main.ts index 13485c2..372b024 100644 --- a/script/build-main.ts +++ b/script/build-main.ts @@ -19,6 +19,7 @@ const argv = minimist(process.argv.slice(2)) const opts = options(argv.env) const TAG = '[build-main.ts]' const spinner = ora(`${TAG} Electron build...`) +process.env.NODE_ENV = argv.env if (argv.watch) { waitOn({ port: process.env.PORT as string }).then(msg => { diff --git a/typings/global.d.ts b/typings/global.d.ts index 22db89b..42be2a3 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -1,7 +1,7 @@ declare namespace NodeJS { interface ProcessEnv { - readonly NODE_ENV: 'development' | 'production' + NODE_ENV: 'development' | 'production' readonly PORT: string } }