uglifier icon indicating copy to clipboard operation
uglifier copied to clipboard

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

Open LucasArruda opened this issue 5 years ago • 3 comments

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.

LucasArruda avatar Apr 18 '19 18:04 LucasArruda

@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...

matissg avatar May 12 '19 05:05 matissg

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 avatar May 12 '19 14:05 LucasArruda

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).

LucasArruda avatar May 12 '19 14:05 LucasArruda