Compiling ES6 syntax with Uglifier on
Public
02 Jan 06:57

When you try to compile ES6 syntax with Uglifier gem initialized you get this error:

Uglifier::Error: (...) To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true)

To fix this just change

config.assets.js_compressor = :uglifier

into

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

in config/environments/production.rb or whatever environment you’re using on production.

Comments

Empty! You must sign in to add comments.