lautis / uglifier

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

Exclude react component names to get minified #107

Closed nextofsearch closed 7 years ago

nextofsearch commented 7 years ago

Hi,

Is there anyway to exclude react component names to get minified?

Thanks,

nextofsearch commented 7 years ago

I tried both options but the web server gets hung

config.assets.js_compressor = Uglifier.new(keep_fnames: true)

config.assets.js_compressor = Uglifier.new(mangle: {keep_fnames: true})

What would be the correct options?

lautis commented 7 years ago

What does the input JS for Uglifier after Babel (if used) look like? This might depend a bit on how you're writing your JS and what's your ES6 to ES5 compilation setup.

andyklimczak commented 7 years ago

Running into same thing with es6 syntax for react-rails. reactjs/react-rails#668 is probably related to this.

Apologies if not!

lautis commented 7 years ago

There's now ES6 syntax support with the (experimental) harmony flag. In Rails application.rb, add config.assets.js_compressor = Uglifier.new(harmony: true).