From c309ec0ec6c3a0822139b11db3662d96398254c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Tue, 19 Aug 2025 15:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=8E=AF=E5=A2=83=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E5=90=A6=E5=8F=96=E6=B6=88=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vite/build.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/vite/build.js b/build/vite/build.js index 37e9c28..e47d000 100644 --- a/build/vite/build.js +++ b/build/vite/build.js @@ -1,4 +1,5 @@ export function createBuild(viteEnv) { + const env = import.meta.env.VITE_ENV; const { VITE_OUTPUT_DIR } = viteEnv; return { sourcemap: false, // 是否启用 @@ -36,8 +37,8 @@ export function createBuild(viteEnv) { // 压缩配置 terserOptions: { compress: { - drop_console: true, // 生产环境移除console - drop_debugger: true // 生产环境移除debugger + drop_console: env == "production", // 生产环境移除console + drop_debugger: env == "production" // 生产环境移除debugger } } };