Skip to content

Commit 7a5da2e

Browse files
committed
Use uglifier harmony mode to handle es6 syntax with rails 7
We were getting the following error in production mode: ``` RAILS_ENV=production bundle exec rake evm:compile_assets ... rake aborted! Uglifier::Error: Unexpected token: punc ((). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true). ``` Note, this change makes all rails processes in production and test load uglifier even if they'll never use it. This is because we're eager loading it, instead of delay loading it via a symbol. It sounds like we can possibly resolve this by figuring out which es6 syntax it doesn't like See https://www.github.com/lautis/uglifier/issues/127
1 parent 40cd8fc commit 7a5da2e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/manageiq/ui/classic/engine.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ class Engine < ::Rails::Engine
3737
config.assets.paths << root.join('vendor', 'assets', 'stylesheets').to_s
3838

3939
if Rails.env.production? || Rails.env.test?
40-
config.assets.js_compressor = :uglifier
40+
# Workaround rails 7 + es6 syntax in some js causing uglifier errors by running harmony mode
41+
# See: https://www.github.com/lautis/uglifier/issues/127
42+
require 'uglifier'
43+
config.assets.js_compressor = Uglifier.new(:harmony => true)
4144
end
4245

4346
def self.vmdb_plugin?

0 commit comments

Comments
 (0)