diff --git a/vite.config.js b/vite.config.js index 030dbdf..ccb9237 100644 --- a/vite.config.js +++ b/vite.config.js @@ -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,