From 310695bb7a664ea16e56503b2739c45db1182122 Mon Sep 17 00:00:00 2001 From: scamiv <6170744+scamiv@users.noreply.github.com> Date: Sun, 8 Feb 2026 04:50:03 +0100 Subject: [PATCH] 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. --- vite.config.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 049c00954..0cde50dd4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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, },