AlexanderPavlenko / sprockets_uglifier_with_source_maps

Create javascript source maps for your Rails applications
MIT License
35 stars 13 forks source link

Uglifier::Error: Unexpected token: keyword (const) #9

Open parterburn opened 6 years ago

parterburn commented 6 years ago

When deploying on Heroku, there's a new error that popped up after upgrading to the latest Sprockets, per the vulnerability described at https://blog.heroku.com/rails-asset-pipeline-vulnerability

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

Gem versions:

sprockets (3.7.2)
sprockets_uglifier_with_source_maps (2.1.0)
uglifier (4.1.11)
sprockets-rails (3.2.1)
parterburn commented 6 years ago

I got around this by adding config.assets.uglifier = { harmony: true } above config.assets.js_compressor = :uglifier_with_source_maps in production.rb.

Halt commented 5 years ago

in production.rb change to: config.assets.js_compressor = Uglifier.new(harmony: true)