From 8524c027f2ec3fd043f7ff3d03facc52dbef91ad Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Thu, 18 Apr 2024 18:30:50 -0400 Subject: [PATCH] Fix Uglifier::Error during production compilation --- config/environments/production.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 489e770d6f..578ac83ecd 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -24,9 +24,6 @@ # Apache or NGINX already handles this. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? - # Compress CSS using a preprocessor. - # config.assets.css_compressor = :sass - # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false @@ -43,7 +40,13 @@ value_max_bytes: 16.megabytes} # Compress JavaScripts and CSS. - config.assets.js_compressor = Uglifier.new(harmony: true) + # + # Normally we would want to enable Harmony, but this seems to work regardless: + # https://github.com/lautis/uglifier/issues/185#issuecomment-1138334525 + config.assets.configure do |env| + env.js_compressor = :uglifier + env.css_compressor = :sass + end # For nginx: config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"