From 022487b93934b47f6f1ba3df0b5843c5dbc2792b Mon Sep 17 00:00:00 2001 From: Mark Taylor <138604938+mtaylorgds@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:45:42 +0000 Subject: [PATCH] Replace Uglifier with Terser for JS compression Uglifier does not support ES6, and Terser is the recommended replacement in the Uglifier README (and is the default option for Rails apps these days). --- Gemfile | 2 +- Gemfile.lock | 6 +++--- config/environments/production.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 78254ffbc..122c916ec 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem "sprockets-rails" gem "state_machines" gem "state_machines-mongoid" gem "strip_attributes" -gem "uglifier" +gem "terser" gem "whenever", require: false group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 40a08eb06..6fcb83a6e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -739,14 +739,14 @@ GEM statsd-ruby (1.5.0) strip_attributes (1.13.0) activemodel (>= 3.0, < 8.0) + terser (1.1.20) + execjs (>= 0.3.0, < 3) thor (1.3.0) tilt (2.0.10) timecop (0.9.8) timeout (0.4.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.8.2) @@ -832,8 +832,8 @@ DEPENDENCIES state_machines-graphviz state_machines-mongoid strip_attributes + terser timecop - uglifier webmock whenever diff --git a/config/environments/production.rb b/config/environments/production.rb index 30c442df7..b5c9a1cee 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -25,7 +25,7 @@ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + config.assets.js_compressor = :terser # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false