Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): Use terser-webpack-plugin instead of uglifyjs-webpack-plugin #2310

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

towerofnix
Copy link
Contributor

Proposed Changes

This PR does three things:

  • Mark [email protected] (an existing dependency, via webpack) as a saved dev dependency.
  • Remove dev dependency uglifyjs-webpack-plugin.
  • Replace UglifyJsPlugin with TerserPlugin in Webpack config.

Reason for Changes

uglifyjs-webpack-plugin is deprecated. The docs indicate to use terser-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 how package-lock.json changes only include removing dependencies.

Marking terser-webpack-plugin as saved at all is required:

Webpack v5 comes with the latest terser-webpack-plugin out of the box. If you are using Webpack v5 or above and wish to customize the options, you will still need to install terser-webpack-plugin. Using Webpack v4, you have to install terser-webpack-plugin v4.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant