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

Research a replacement for uglifier's harmony mode for uglifying es6 - terser appears to be the suggested alternative #9246

Open
jrafanie opened this issue Aug 8, 2024 · 3 comments

Comments

@jrafanie
Copy link
Member

jrafanie commented Aug 8, 2024

From #9245

FYI, it looks like uglifier's harmony path going forward is in doubt: https://www.github.com/lautis/uglifier/issues/193:

The harmony project in UglifyJS has been without updates for a long time.
Can you warn to use terser when compiling with the harmony option set to true?

They're suggesting we move to terser in the future.

There was a comment here describing how to check all your assets to see which ones are failing to load with uglifier due to this es6 problem. https://www.github.com/lautis/uglifier/issues/127#issuecomment-483313583

@Fryguy
Copy link
Member

Fryguy commented Aug 14, 2024

Another option is to drop uglifier entirely and leave it uncompressed. Or, after that it might possible to use a webpack plugin to do the js compression.

We should also research if Apache has anything for us.

@jrafanie
Copy link
Member Author

mod_deflate might be an option: https://httpd.apache.org/docs/current/mod/mod_deflate.html

@jrafanie jrafanie changed the title Research a replacement for uglifier / harmony for uglifying es6 - terser appears to be the suggested alternative Research a replacement for uglifier's harmony mode for uglifying es6 - terser appears to be the suggested alternative Aug 14, 2024
@Fryguy
Copy link
Member

Fryguy commented Aug 14, 2024

So there's gzip compression, and then there's uglify-js style compression...we can possibly do both.

I was doing a quick plugin search, and stumbled on https://stackoverflow.com/questions/65298689/uglifyjs-and-webpack-v5, which basically says that the ugjlify-js webpack plugin only works with webpack 4, but on webpack 5 there's a terser plugin instead. I'm wondering if we can just use it directly in our webpack config and then we don't need any Rails-side js compression.

https://github.com/webpack-contrib/terser-webpack-plugin

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

No branches or pull requests

2 participants