Open CodingAnarchy opened 5 years ago
There are *.coffee
and *.js.jsx
files in the app/assets/javascripts
directory tree, but I tried that with the example app without issue, so it is unclear to me whether that matters.
In my case, //=
in coffee-script file caused a similar error on sprockets v4.0.0.
# app/assets/javascripts/foo.js.coffee
//= require jquery
ExecJS::ProgramError: SyntaxError: [stdin]:1:1: unexpected //= compile ((execjs):7528:19)
(execjs):1:10 /usr/local/bundle/gems/mini_racer-0.2.6/lib/mini_racer.rb:201:in `eval_unsafe'
/usr/local/bundle/gems/mini_racer-0.2.6/lib/mini_racer.rb:201:in `block (2 levels) in eval'
/usr/local/bundle/gems/mini_racer-0.2.6/lib/mini_racer.rb:286:in `timeout' /usr/local/bundle/gems/mini_racer-0.2.6/lib/mini_racer.rb:200:in `block in eval'
/usr/local/bundle/gems/mini_racer-0.2.6/lib/mini_racer.rb:198:in `synchronize' /usr/local/bundle/gems/mini_racer-0.2.6/lib/mini_racer.rb:198:in `eval'
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:27:in `block in eval' /usr/local/bundle/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:66:in `translate'
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:26:in `eval' /usr/local/bundle/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:34:in `call'
/usr/local/bundle/gems/coffee-script-2.4.1/lib/coffee_script.rb:78:in `compile' /usr/local/bundle/gems/sprockets-4.0.0/lib/sprockets/coffee_script_processor.rb:24:in `block in call'
/usr/local/bundle/gems/sprockets-4.0.0/lib/sprockets/cache.rb:92:in `fetch' /usr/local/bundle/gems/sprockets-4.0.0/lib/sprockets/coffee_script_processor.rb:23:in `call'
...
and this error was fixed by replacing //=
with #=
like this:
# app/assets/javascripts/foo.js.coffee
#= require jquery
Expected behavior
Sprockets v4.0 should precompile my assets as expected, Sprockets v3.0 did. (I upgraded my app by adding a manifest file and following the other instructions per the upgrade guide.)
Manifest file is as follows:
Actual behavior
System configuration
I tried to create an example app, but I couldn't seem to replicate the problem just by adding files (at least none that weren't my real production files, which my work hasn't allowed me to share).