From bf41bded8b52b3a6aab808b8d6066cac3b34661a Mon Sep 17 00:00:00 2001 From: Peanut Date: Wed, 18 Mar 2026 22:50:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(mini-program):=20=E6=B7=BB=E5=8A=A0=20env.?= =?UTF-8?q?js=20=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E8=AF=8A=E6=96=AD?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 getConfig() 函数中添加条件日志输出 - 输出原始环境变量、解析后配置、来源标识 - 仅在 DEBUG=true 时打印 --- mini-program/src/config/env.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mini-program/src/config/env.js b/mini-program/src/config/env.js index f851c19..d9007ee 100644 --- a/mini-program/src/config/env.js +++ b/mini-program/src/config/env.js @@ -39,6 +39,19 @@ const getConfig = () => { const debug = import.meta.env.VITE_DEBUG !== undefined ? import.meta.env.VITE_DEBUG === 'true' : base.DEBUG + + // 添加诊断日志 + if (debug) { + console.log('[ENV] 环境配置:', { + rawEnv: import.meta.env.VITE_APP_ENV, + normalizedEnv: currentEnv, + API_BASE_URL: apiBaseUrl, + WS_URL: wsUrl, + DEBUG: debug, + isFromEnvFile: import.meta.env.VITE_API_BASE_URL ? 'yes' : 'fallback-to-config' + }) + } + return { API_BASE_URL: apiBaseUrl, WS_URL: wsUrl,