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

Document webpack change: Switch from uglifyjs-webpack-plugin to terser-webpack-plugin #2520

Closed
webpack-bot opened this issue Sep 16, 2018 · 1 comment
Labels
webpack5 Docs for webpack 5
Milestone

Comments

@webpack-bot
Copy link

A pull request by @edmorley was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#8036


Some history:

  • uglifyjs-webpack-plugin < v1.0 used the minifier uglify-js
  • however uglify-js does not support ES6, which resulted in a fork called uglify-es that was developed in the uglify-js repository, but under the harmony branch
  • uglifyjs-webpack-plugin v1.x switched to uglify-es for ES6 support
  • however uglify-es stopped being maintained
  • which led to a fork called terser that has incorporated all of the unmerged PRs and will be where all new development occurs
  • terser-webpack-plugin was created, which is the terser equivalent of uglifyjs-webpack-plugin
  • uglifyjs-webpack-plugin v2.x has switched back to uglify-js, so any project that needs to support ES6 now needs to switch to terser-webpack-plugin instead.

Fixes #7923.

What kind of change does this PR introduce?

Bugfix I guess? (since terser includes many correctness fixes)

Did you add tests for your changes?

There are existing tests which have been updated for the plugin name change.

Does this PR introduce a breaking change?

Yes. The new plugin:

  • requires the minifier options to be passed under terserOptions, rather than the previous uglifyOptions.
  • has changed the method signature that should be used when specifying a warningsFilter function.

What needs to be documented once your changes are merged?

@sokra sokra added this to the webpack 5 milestone Sep 16, 2018
montogeek pushed a commit that referenced this issue Sep 18, 2018
)

* docs(config): Replace UglifyJSPlugin references with TerserPlugin

Since the default `options.minimizer` is now `terser-webpack-plugin`:
webpack/webpack#8036

I've also:
* updated the custom `minimizer` example to include all of the default
  options, to reduce the chance people forget to enable them.
* removed the `optimize/UglifyJsPlugin` reference, since it's no
  longer included in the webpack repository.
* removed the "Here are a few more popular ones" mention, since it's
  not accurate (they aren't more popular).
* removed manual plugin configuration from `configuration-languages.md`
  since the defaults for `minimizer` make it unnecessary.

Fixes #2520.

* Address review comment
@edmorley
Copy link
Contributor

edmorley commented Oct 1, 2018

This can be closed since it was fixed by #2522.

@sokra sokra added webpack5 Docs for webpack 5 and removed webpack5 Docs for webpack 5 labels Dec 12, 2018
@hulkish hulkish closed this as completed Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
webpack5 Docs for webpack 5
Projects
None yet
Development

No branches or pull requests

4 participants