-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Swap uglify for terser #2873
Swap uglify for terser #2873
Conversation
JS File Size Changes (gzipped)A total of 95 files have changed, with a combined diff of +466 B (+0.5%).
|
This isn't a technical limitation but an intentional choice. Prism v1.x is an ES5 project to support older browsers such as IE11. (I know that IE11 actually supports some ES6 features (such as Therefore:
For these reasons, I will now close this PR. @NullVoxPopuli |
all good. do you have thoughts on transpiling down to ES5? |
Interesting that switching to Terser made all of the builds larger as well. If we continued to support our given syntax set but the minifier produced better results, I'd be in support but it seems like Terser produces worse results across the board for our codebase. |
afaict, This is only because the variable There are a bunch of options that I haven't touched, and I'm no terser expert, so 🤷 |
Yes, terser is a little bit worse than uglify for ES5 but not by much. When talking about minified ES6+ code, it can do a bit more. |
Well I was going to say terser can typically do much better than it's defaults (and this may still be true), but for us the difference is only 1% (300 bytes)... so I guess it all depends. It's also possible we don't have it tuned as finely as it could be as well. :) Though we also do some things to increase size like use |
I don't think that's the case because all of the languages are wrapped in IIFEs and pass in Prism, so they're mostly not referencing the global Prism. I only mention this because my general thing is keeping the bundle small, so if you wanna spend some time configuring Terser to produce smaller bundles, I'm all for it. As for ES6, I believe we need IE11 support for our unminified code as well, so I think that's a no go until the V2 rewrite. |
While working on: #2868
I noticed that the existing build system does not support
const
orlet
.This PR removes uglify, which does not support ES6+, and replaces it with terser via https://www.npmjs.com/package/gulp-terser
Depending on Prism's browser support policy this will force a breaking change.
This PR is split into two commits: