fix:打包后去掉调试代码

This commit is contained in:
lz-ui 2025-09-28 16:16:43 +08:00
parent cab26cdc30
commit 2ce3bcae33

View File

@ -42,6 +42,14 @@ export default defineConfig(({ mode, command }) => {
build: {
// https://vite.dev/config/build-options.html
sourcemap: command === 'build' ? false : 'inline',
minify: 'terser', // 启用 terser 压缩
terserOptions: {
compress: {
pure_funcs: ['console.log'], // 只删除 console.log
//drop_console: true, // 删除所有 console
drop_debugger: true, // 删除 debugger
}
},
outDir: 'dist',
assetsDir: 'assets',
chunkSizeWarningLimit: 2000,