npm / terser-webpack-plugin
terser-webpack-plugin
What changed in terser-webpack-plugin 2 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
15 breaking3 deprecations5 new APIs and options2 performance7 behavior and defaults1 tooling5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initterser-webpack-plugin 519 changes
Breaking changes 4
The
cacheoption was removed; the plugin respects webpack'scacheoption by default.The
cacheKeysoption was removed; the plugin respects webpack'scacheoption by default.The
sourceMapoption was removed; the plugin respects webpack'sdevtooloption by default.webpack 4 is no longer supported.
Deprecations 3
The project recommends switching to minimizer-webpack-plugin, a single plugin for minification that merges other minimizers and supports different minifier types in one instance.
minimizerOptions replaces terserOptions; terserOptions remains available as a deprecated alias.
terserOptions is deprecated in favor of minimizerOptions but remains available as an alias.
New APIs and options 5
Built-in CSS minimizers from css-minimizer-webpack-plugin are available in the plugin.
Minimizers gain a filter method, allowing one plugin instance to handle multiple asset types.
Built-in HTML minimizers from html-minimizer-webpack-plugin are available in the plugin.
The minify option now supports an array of minimizers, allowing multiple minimizers to be configured.
Adds the ability to minimize JSON using jsonMinify.
Performance 2
Deduplicating extracted comments now takes linear time, keeping builds fast when an asset contains many distinct preserved comments.
A performance improvement was made.
Behavior and default changes 2
The terserOptions option now supports an array of minimizers.
extractComments is now supported with swcMinify, allowing comments to be extracted when using the SWC minifier.
Fixes and other changes 3
Fixes handling of empty files.
Errors and warnings from a minimizer are respected when it returns no code.
Errors are caught when loading minimizers.
terser-webpack-plugin 44 changes
Breaking changes 3
The minify option's return value changed; only code, map, and extractedComments are valid.
The terser version is now 5.
The warningsFilter option was removed without replacement.
Fixes and other changes 1
Compatibility with webpack 5 was improved.
terser-webpack-plugin 36 changes
Breaking changes 4
The chunkFilter option was removed; use test, include, or exclude options instead.
A filename that conflicts with existing assets now causes an error instead of a warning.
The minimum supported Node.js version is now 10.13.
The callback arguments are now ordered file, warning, source instead of warning, file, source.
Behavior and default changes 1
When filename is a function, it receives one object argument with filename, basename, query, and hash properties.
Tooling 1
The optimizeAssets hook is used for webpack 5.
terser-webpack-plugin 29 changes
Breaking changes 4
When extractComments.condition is true, only some comments are extracted.
The extractComments option is enabled by default.
The minimum required Node.js version is 8.9.0.
The sourceMap option now defaults to depending on the Webpack devtool option.
Behavior and default changes 4
The cache option is enabled by default.
The extractComments API is made more consistent.
The parallel option is enabled by default.
Parallel mode is not run when there is only one file.
Fixes and other changes 1
Fixes parallel mode on WSL.