From 5ce2150706595b6c073934cfdb9f21fe1d1c3cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=A0=E9=BE=99?= Date: Thu, 19 May 2022 12:02:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dvite=E7=83=AD=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E5=90=8Eproxy=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/utils.js b/build/utils.js index 81765f6..24cd764 100644 --- a/build/utils.js +++ b/build/utils.js @@ -16,7 +16,7 @@ export function wrapperEnv(envOptions) { if (['VITE_PORT'].includes(key)) { val = +val } - if (key === 'VITE_PROXY' && val) { + if (key === 'VITE_PROXY' && val && typeof val === 'string') { try { val = JSON.parse(val.replace(/'/g, '"')) } catch (error) { @@ -24,9 +24,9 @@ export function wrapperEnv(envOptions) { } } ret[key] = val - if (typeof key === 'string') { + if (typeof val === 'string') { process.env[key] = val - } else if (typeof key === 'object') { + } else if (typeof val === 'object') { process.env[key] = JSON.stringify(val) } }