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 } } };