From 729a8dce8196c8163a2f02d22921983a184cd3b3 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 17 Mar 2024 23:33:22 +0800 Subject: [PATCH] fix: env variables have been modified --- packages/core/cli/src/util.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/cli/src/util.js b/packages/core/cli/src/util.js index 93dbbd02c..5764e5f60 100644 --- a/packages/core/cli/src/util.js +++ b/packages/core/cli/src/util.js @@ -348,15 +348,17 @@ exports.initEnv = function initEnv() { } } - if (process.env.APP_PUBLIC_PATH) { + if (!process.env.__env_modified__ && process.env.APP_PUBLIC_PATH) { const publicPath = process.env.APP_PUBLIC_PATH.replace(/\/$/g, ''); const keys = ['API_BASE_PATH', 'WS_PATH', 'PLUGIN_STATICS_PATH']; for (const key of keys) { process.env[key] = publicPath + process.env[key]; } + process.env.__env_modified__ = true; } - if (process.env.APP_SERVER_BASE_URL && !process.env.API_BASE_URL) { + if (!process.env.__env_modified__ && process.env.APP_SERVER_BASE_URL && !process.env.API_BASE_URL) { process.env.API_BASE_URL = process.env.APP_SERVER_BASE_URL + process.env.API_BASE_PATH; + process.env.__env_modified__ = true; } };