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

chore(v2): switch from uglifyjs-webpack-plugin to terser-webpack-plugin #1099

Merged
merged 1 commit into from
Nov 8, 2018

Conversation

endiliey
Copy link
Contributor

@endiliey endiliey commented Nov 8, 2018

Motivation

Currently, we use uglify via uglifyjs-webpack-plugin.

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:
    uglify-es is stale mishoo/UglifyJS#3156 (comment)
  • which led to a fork called terser that has incorporated all of
    the unmerged PRs and will be where all new development occurs:
    https://github.com/fabiosantoscode/terser
  • terser-webpack-plugin was created, which is the terser equivalent
    of uglifyjs-webpack-plugin:
    https://github.com/webpack-contrib/terser-webpack-plugin
  • uglifyjs-webpack-plugin v2.x will be switching back to uglify-js,
    so any project that needs to support ES6 now needs to switch to
    terser-webpack-plugin.

Some references
Create-react-app use Terser
Webpack v5 will use terser plugin by default.
webpack/webpack#7923
webpack-contrib/terser-webpack-plugin#15

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Before

before

After

after

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 8, 2018
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-preview ready!

Built with commit d527e48

https://deploy-preview-1099--docusaurus-preview.netlify.com

@endiliey endiliey merged commit fc7ba5b into facebook:master Nov 8, 2018
@endiliey endiliey deleted the terser branch November 8, 2018 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants