I have some code using template strings which works in development, but the push to Heroku fails with this error:
ExecJS::RuntimeError: SyntaxError: Unexpected character '`'
Running bundle exec rake assets:precompile RAILS_ENV=production
shows the same thing.
The code is something like this:
`1 + 1 is ${1 + 1}`
I wonder if the Heroku Node version is too low to support this. I'm not customizing this at all. Just pushing a Rails 4 app with the default configuration.
I eventually found this thread: https://github.com/browserify-rails/browserify-rails/issues/137
where I found the recommendation to comment out the line:
config.assets.js_compressor = :uglifier
The problem is that the 'uglifier' (minifier) was not working correctly with the ES6 syntax.
As the thread mentions, using this fix means that the scripts will no longer be minified, so I'd still be curious if there's a better solution.