build: enhance Terser configuration for production minification

- Update Terser options to enable top-level mangling and increase compression passes from 2 to 3.
- Improve minification by dropping unused top-level variables and functions.
This commit is contained in:
scamiv
2026-02-08 04:50:03 +01:00
parent 6d6988f1f7
commit 310695bb7a
+3 -2
View File
@@ -100,8 +100,9 @@ export default defineConfig(({ mode }) => {
minify: isProduction ? "terser" : false,
...(isProduction && {
terserOptions: {
compress: { passes: 2 },
mangle: true,
toplevel: true, // Mangle top-level names and drop unused top-level vars/functions
compress: { passes: 3 },
mangle: { toplevel: true }, // Shorten top-level function/variable names
format: {
comments: false,
},