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

Uglifier Cannot Precompile JS Optional Chaining #2607

Closed
kduraiswami opened this issue May 28, 2020 · 2 comments
Closed

Uglifier Cannot Precompile JS Optional Chaining #2607

kduraiswami opened this issue May 28, 2020 · 2 comments

Comments

@kduraiswami
Copy link

Hi There

I am trying to precompile assets with config.assets.js_compressor = Uglifier.new(harmony: true) and I receive the error Uglifier::Error: Unexpected token: punc (.) for JS syntax like this: .data('id'))?.advanced_settings

Full Stacktrace:

/mypath/app/assets/config/manifest.js:2
/usr/local/rvm/gems/ruby-2.5.1/gems/uglifier-4.2.0/lib/uglifier.rb:291:in parse_result' /usr/local/rvm/gems/ruby-2.5.1/gems/uglifier-4.2.0/lib/uglifier.rb:221:in run_uglifyjs'
/usr/local/rvm/gems/ruby-2.5.1/gems/uglifier-4.2.0/lib/uglifier.rb:166:in compile' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/compressing.rb:65:in block in js_compressor='
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/legacy_proc_processor.rb:31:in call' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in call_processor'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in block in call_processors' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in reverse_each'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in call_processors' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in load_from_unloaded'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in block in load' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in load' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in block in initialize'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in load' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:388:in load'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:357:in block in link_paths' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:367:in block in resolve_paths'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:363:in each' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:363:in resolve_paths'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:356:in link_paths' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:317:in process_link_directory_directive'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:180:in block in process_directives' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in each'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in process_directives' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:83:in _call'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:68:in call' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in call_processor'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in block in call_processors' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in reverse_each'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in call_processors' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in load_from_unloaded'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in block in load' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in load' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in block in initialize'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in load' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in block in call'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in dfs' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in call'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in call_processor' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in block in call_processors'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in reverse_each' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in call_processors'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in load_from_unloaded' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in block in load'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in fetch_asset_from_dependency_cache' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in load'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in block in initialize' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in load'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in find_asset' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in find_all_linked_assets'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in block in find' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in each'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in find' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in compile'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in block (3 levels) in define' /usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in with_logger'
/usr/local/rvm/gems/ruby-2.5.1/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in block (2 levels) in define' /usr/local/rvm/gems/ruby-2.5.1/gems/rake-13.0.1/exe/rake:27:in <top (required)>'
/usr/local/rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in eval' /usr/local/rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in

'
Tasks: TOP => assets:precompile

Let me know if I can provide any additional context or if this has already been fixed elsewhere.

@kduraiswami
Copy link
Author

Posted this here instead of on the Uglifier github on accident, sorry about that!

@cs0511
Copy link

cs0511 commented Nov 26, 2020

FYI, lautis/uglifier#174

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