Skip to content

Commit b1e348f

Browse files
authored
perf: enhance TerserPlugin configuration for optimized compression and mangling (#65)
- Improved TerserPlugin compression by enabling `arguments` compression and increasing `passes` to 3 for better code optimization. - Enabled `toplevel` mangling to reduce file size by optimizing top-level scope variables. - Added `nameCache` to ensure consistent mangling between builds, improving cache performance. - Maintained `sourceMap` support for easier debugging of minified code.
1 parent 81a47cc commit b1e348f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

webpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,14 @@ module.exports = {
200200
new TerserPlugin({
201201
extractComments: true,
202202
terserOptions: {
203+
compress: {
204+
arguments: true,
205+
passes: 3,
206+
},
203207
mangle: true,
204-
sourceMap: true
208+
toplevel: true,
209+
sourceMap: true,
210+
nameCache: {},
205211
}
206212
}),
207213
new ImageMinimizerPlugin({

0 commit comments

Comments
 (0)