From 3bdd4cddba3837c20a4209a27564e73cabaa0392 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Tue, 21 Oct 2025 16:31:32 +0800
Subject: [PATCH] feat: 打包环境调整

---
 vite.config.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/vite.config.js b/vite.config.js
index f77f5cb..084e427 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -9,12 +9,12 @@
   // mode: 区分生产环境还是开发环境
   console.log("command, mode -> ", command, mode)
 
-  const { UNI_PLATFORM } = process.env
-  console.log("UNI_PLATFORM -> ", UNI_PLATFORM) // 得到 mp-weixin, h5, app 等
+  const { UNI_PLATFORM,UNI_CUSTOM_DEFINE } = process.env
+  console.log("平台 -> ", UNI_PLATFORM) // 得到 mp-weixin, h5, app 等
+  console.log("环境 -> ", UNI_CUSTOM_DEFINE && JSON.parse(UNI_CUSTOM_DEFINE)?.ENV_NAME) // 得到 development,test 等
 
   const env = loadEnv(mode, fileURLToPath(new URL("./env", import.meta.url)))
-  console.log("环境变量 env -> ", env)
-
+  // console.log("环境变量 env -> ", env)
   const isBuild = process.env.NODE_ENV === "production"
   return {
     // 自定义env目录

--
Gitblit v1.9.3