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

Replace uglifyjs with terser #2076

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

Replace uglifyjs with terser #2076

wants to merge 1 commit into from

Conversation

j-maas
Copy link

@j-maas j-maas commented Mar 20, 2020

terser does not require two passes. I tried out running the --compress and --mangle passes separately, but running one pass with --compress --mange yields the exact same byte count (just as it should be). (uglifyjs, even in the current version 3.8.0, still requires two passes.)

The compression is very close to uglifyjs. uglifyjs takes a 691.340 bytes elm.js to 147.094 bytes, while terser yields 149.607 bytes.

The reason I tried out terser was that uglifyjs does not handle modern JavaScript (newer than ES5), which lead to an issue in elm-pages. Terser does, is nicely documented, and easily replaces uglifyjs.

Supporting modern JS is not really relevant here right now, since the Elm compiler outputs ES5. But that terser only requires one pass makes explaining it easier.

@jhrcek
Copy link

jhrcek commented Mar 21, 2020

The comment you're linking talks about uglify-es and is two years old.
uglify-js seems to be very much alive judging by the activity in the repository. I have nothing against your proposed PR, just bringing this up to prevent potential misunderstanding.

@j-maas
Copy link
Author

j-maas commented Mar 21, 2020

Sorry, that is true! I got confused there. I will update the comment. Thanks for the correction!

terser does not require two passes and does everything with one call.
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.

2 participants