fix(deps): Use terser-webpack-plugin instead of uglifyjs-webpack-plugin #2310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This PR does three things:
[email protected]
(an existing dependency, via webpack) as a saved dev dependency.uglifyjs-webpack-plugin
.UglifyJsPlugin
withTerserPlugin
in Webpack config.Reason for Changes
uglifyjs-webpack-plugin
is deprecated. The docs indicate to useterser-webpack-plugin
instead.The version
[email protected]
is selected as it's the version which was previously installed (as a dependency of[email protected]
, matching^1.4.3
). This means we don't actually add or update any dependencies: note howpackage-lock.json
changes only include removing dependencies.Marking
terser-webpack-plugin
as saved at all is required:Removing uglifyjs-webpack-plugin is necessary to update to Webpack v5. uglifyjs-webpack-plugin has not been updated since 2019 and strictly requires Webpack v4. Terser is the replacement Webpack recommends, and is supported on both v4 and v5.
Webpack v4 itself is deprecated as well, and due to a compatibility change, prevents readily running on Node above 16. Node 16 left maintenance LTS support in October 2023, so the development environment is now depending on a wholly unsupported version of Node, partially due to Webpack (and consequently
uglifyjs-webpack-plugin
).Test Coverage
All existing tests pass, the build succeeds, and
npm start
is also functioning as normal.