mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 12:51:30 +00:00
build: use Terser for production minification
- Add terser devDependency and set build.minify to "terser" in production - Enable source maps only for non-production builds - Disable minification for dev builds - Terser options: mangle names, strip comments, 2 compress passes
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user