Actions
Refactor #26790
closedRecognize ES6 syntax in asset pipeline when compressing for production
Difficulty:
Triaged:
No
Description
As more legacy js code is moved into webpack, often elements of ES6 syntax are used. However, there are plugins that rely on some parts of the moved js files and are not not webpacked. The problem is that Uglifier is not able to recognize ES6 syntax when compiling assets in production for a non-webpacked plugin and the plugin relies on webpacked assets from core.
Steps to reproduce:
1) foreman 1.22 or later, foreman_openscap 1.0.0
2) rake plugin:assets:precompile['foreman_openscap'] RAILS_ENV='production'
rake aborted! Uglifier::Error: Unexpected token: punc ()). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true). /home/vagrant/.rvm/gems/ruby-2.4.1/gems/uglifier-4.1.20/lib/uglifier.rb:234:in `parse_result' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/uglifier-4.1.20/lib/uglifier.rb:216:in `run_uglifyjs' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/uglifier-4.1.20/lib/uglifier.rb:168:in `compile' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:53:in `call' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:28:in `call' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in `block in find' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `each' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `find' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile' /home/vagrant/projects/foreman/lib/tasks/plugin_assets.rake:24:in `block in compile' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger' /home/vagrant/projects/foreman/lib/tasks/plugin_assets.rake:23:in `compile' /home/vagrant/projects/foreman/lib/tasks/plugin_assets.rake:63:in `block in <top (required)>' /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rake-12.3.2/exe/rake:27:in `<top (required)>' /home/vagrant/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval' /home/vagrant/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>' Tasks: TOP => plugin:assets:precompile (See full trace by running task with --trace)
Updated by Ondřej Pražák over 5 years ago
- Related to Bug #26606: Support gridster for plugins added
Updated by The Foreman Bot over 5 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/6755 added
Updated by Ohad Levy over 5 years ago
- Target version set to 1.23.0
- Fixed in Releases 1.23.0 added
Updated by Ondřej Pražák over 5 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 940c0e02be5e8138cb3f3691bf20b41cc8da42df.
Updated by The Foreman Bot over 5 years ago
- Pull request https://github.com/theforeman/foreman/pull/6759 added
Updated by Anonymous over 5 years ago
- Target version changed from 1.23.0 to 1.22.0
- Fixed in Releases 1.22.0 added
Updated by Adam Ruzicka over 5 years ago
- Related to Bug #26800: Running db migrations on nightlies fails with "LoadError: cannot load such file -- uglifier" added
Updated by Tomer Brisker over 5 years ago
- Status changed from Closed to Rejected
- Fixed in Releases deleted (
1.22.0, 1.23.0)
The fix for this caused other issues and was reverted.
Actions