lautis / uglifier

Ruby wrapper for UglifyJS JavaScript compressor.
http://www.rubydoc.info/gems/uglifier
MIT License
613 stars 82 forks source link

Uglify 4 having problems with ES6 assets, while 3 works fine #162

Open LucasArruda opened 5 years ago

LucasArruda commented 5 years ago

Not really understanding what is going on. Perhaps someone can elucidate me on what are the big changes from 3 to 4, but Uglify 3 seems to ignore or not really process webpack files with const on it, while 4 promptly fails.

I know there is this setting to enable ES6 (harmony: true) but I don't want to use something experimental and also lose mangle/compression, which is really important.

Maybe I just need to remove those Javascript files from assets.rb, though I am using them within the app. So not sure that would be ideal.

matissg commented 5 years ago

@LucasArruda Same here. v.3.2 works, however v.4.1.20 throw an error when I do push to my Dokku container - gives me Precompiling assets failed . Would be happy to use the latest gem version, but don't what's wrong...

LucasArruda commented 5 years ago

It seems that there is a way to prevent that, which is also getting latest sprockets, with come with ES6 support.

But, there is a caveat. You have to rename all your ES6 files to .es6 extension, which makes this also problematic since you can't rename other projects, dependencies. I also have multiple projects inside my rails app, which makes this whole process of renaming very problematic.

LucasArruda commented 5 years ago

I want that all (uglifier 4, new sprockets) and for that I'm willing to open a PR on sprockets to fix that when I do have some time. That will also allow usage of webpacker + uglifier 4 (because with sprockets transpiling with babel, uglifier won't have to know about ES6 for now).