Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String interpolation fails #58

Open
Nerian opened this issue Jan 31, 2017 · 1 comment
Open

String interpolation fails #58

Nerian opened this issue Jan 31, 2017 · 1 comment

Comments

@Nerian
Copy link

Nerian commented Jan 31, 2017

Hi,

When there is a javascript code that contains String interpolation an error is raised.

Given a piece of code such as this:

var a = 500
`${a}`

An error like this is raised:

Running: rake assets:precompile
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected character '`' (line: 49741, col: 12, pos: 1488821)
Error
at new JS_Parse_Error (/tmp/execjs20170131-467-r8rh5pjs:3623:11948)
at js_error (/tmp/execjs20170131-467-r8rh5pjs:3623:12167)
at parse_error (/tmp/execjs20170131-467-r8rh5pjs:3623:14184)
at Object.next_token [as input] (/tmp/execjs20170131-467-r8rh5pjs:3623:19902)
at next (/tmp/execjs20170131-467-r8rh5pjs:3623:21852)
at maybe_assign (/tmp/execjs20170131-467-r8rh5pjs:3624:3161)
at expression (/tmp/execjs20170131-467-r8rh5pjs:3624:3384)
at simple_statement (/tmp/execjs20170131-467-r8rh5pjs:3623:25942)
at /tmp/execjs20170131-467-r8rh5pjs:3623:23747
at /tmp/execjs20170131-467-r8rh5pjs:3623:22954
at block_ (/tmp/execjs20170131-467-r8rh5pjs:3623:28083)
at ctor.body (/tmp/execjs20170131-467-r8rh5pjs:3623:27686)
at function_ (/tmp/execjs20170131-467-r8rh5pjs:3623:27782)
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
parse_error ((execjs):3623:14184)
Object.next_token [as input] ((execjs):3623:19902)
next ((execjs):3623:21852)
maybe_assign ((execjs):3624:3161)
expression ((execjs):3624:3384)
simple_statement ((execjs):3623:25942)
(execjs):3623:23747
(execjs):3623:22954
block_ ((execjs):3623:28083)
ctor.body ((execjs):3623:27686)
function_ ((execjs):3623:27782)
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/uglifier-3.0.4/lib/uglifier.rb:184:in `run_uglifyjs'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/uglifier-3.0.4/lib/uglifier.rb:146:in `compile'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:53:in `call'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:28:in `call'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => assets:precompile
@BrianHawley
Copy link

BrianHawley commented Jan 2, 2018

Looks like you're attempting to use a version of uglifier that doesn't support ES6 syntax; string interpolation isn't ES5 compatible. Did you try updating uglifier to a newer version, 3.2.0+ perhaps? You'll also need the harmony: true option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants