Closed wakproductions closed 2 years ago
Hey mate, How did you find that Uglifier was potentially the problem? I'm having a similar issue (pushing to Heroku, Rails 4.2) but not specifically with JS-Datepicker. Whilst still in my app, the offending js file has nothing to do with Datepicker and I'm requiring it similarly to you are in your SO query. Hoping to isolate the issue and see if I can offer some input.
//= require jquery-ui/datepicker
be rake assets:precompile RAILS_ENV=production --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
ExecJS::RuntimeError: SyntaxError: Name expected
(in /Users/user_name/Desktop/app_name/app/assets/javascripts/page-specific/compare_index.js)
JS_Parse_Error.get ((execjs):3538:621)
(execjs):4060:47
(execjs):1:102
Object.<anonymous> ((execjs):1:120)
Module._compile (module.js:569:30)
Object.Module._extensions..js (module.js:580:10)
Module.load (module.js:503:32)
tryModuleLoad (module.js:466:12)
Function.Module._load (module.js:458:3)
Function.Module.runMain (module.js:605:10)
/Users/user_name/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/Users/user_name/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/Users/user_name/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/Users/user_name/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/uglifier-3.2.0/lib/uglifier.rb:195:in `run_uglifyjs'
/Users/user_name/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/uglifier-3.2.0/lib/uglifier.rb:157:in `compile'
...
etc
@batshoes I copied the contents of the problematic file to my clipboard. And then using the Clipboard gem command, did this: Uglifier.compile(Clipboard.paste)
Hi, I'm having the same problem:
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected token: punc ())
JS_Parse_Error.get ((execjs):3538:621)
(execjs):4060:47
(execjs):1:102
Object.<anonymous> ((execjs):1:120)
Module._compile (module.js:624:30)
Object.Module._extensions..js (module.js:635:10)
Module.load (module.js:545:32)
tryModuleLoad (module.js:508:12)
Function.Module._load (module.js:500:3)
Function.Module.runMain (module.js:665:10)
Did you find a solution?
datepicker.js seems to have used ES6 syntax in October, which causes this error with default settings.
Why this issue still open? Setting up like in readme described, resolves this problem.
I am having trouble with using the JS-datepicker Javascript library. When I pushed to Heroku, asset compilation failed, and further investigation has shown that the error originates from Uglifier.
When you copy and paste the contents of datepicker.js into Uglifier, it presents the mentioned error message. However, using the minified
datepicker.min.js
file included in the distribution does not have this issue. As a workaround, I'm using the minified version of the file found in the distribution.