diff --git a/package.json b/package.json index b99fe1fef..12049dbd5 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "sinon": "^21.0.1", "sinon-chai": "^4.0.0", "tailwindcss": "^4.1.18", + "terser": "^5.42.0", "tsconfig-paths": "^4.2.0", "typescript": "^5.7.2", "typescript-eslint": "^8.26.0", diff --git a/vite.config.ts b/vite.config.ts index 4b7af9f86..049c00954 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -96,6 +96,17 @@ export default defineConfig(({ mode }) => { outDir: "static", // Webpack outputs to 'static', assuming we want to keep this. emptyOutDir: true, assetsDir: "assets", // Sub-directory for assets + sourcemap: !isProduction, // Source maps for dev builds only + minify: isProduction ? "terser" : false, + ...(isProduction && { + terserOptions: { + compress: { passes: 2 }, + mangle: true, + format: { + comments: false, + }, + }, + }), rollupOptions: { output: { manualChunks: {