From 36bc9b17e84ee1063d64ec25bd380bc10a684d33 Mon Sep 17 00:00:00 2001 From: Patrick Cartlidge Date: Mon, 13 Nov 2023 14:49:40 +0000 Subject: [PATCH] Use Terser instead of Uglifier govuk_publishing_components has govuk-frontend as a dependency. govuk-frontend v5 now targets browsers that support ES6. This means that the UMD modules used in govuk_publsihing_components from govuk-frontend use features of ES6 and so it means that Uglifier can't be used anymore because it only supports ES5. --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- config/environments/production.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 56e3212b2..aebc193ed 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem "rinku", require: "rails_rinku" gem "rss" gem "slimmer" gem "sprockets-rails" -gem "uglifier" +gem "terser" group :development, :test do gem "govuk_schemas" diff --git a/Gemfile.lock b/Gemfile.lock index a543befdc..984b1810f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -128,7 +128,7 @@ GEM domain_name (0.6.20240107) drb (2.2.1) erubi (1.12.0) - execjs (2.8.1) + execjs (2.9.1) faker (3.3.1) i18n (>= 1.8.11, < 2) gds-api-adapters (95.1.0) @@ -634,13 +634,13 @@ GEM stringio (3.1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) + terser (1.2.2) + execjs (>= 0.3.0, < 3) thor (1.3.1) timecop (0.9.8) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) unicode-display_width (2.5.0) webmock (3.23.0) addressable (>= 2.8.0) @@ -692,8 +692,8 @@ DEPENDENCIES simplecov slimmer sprockets-rails + terser timecop - uglifier webmock RUBY VERSION diff --git a/config/environments/production.rb b/config/environments/production.rb index 9b9617d5c..d3222bf1e 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 JS using a preprocessor. - config.assets.js_compressor = :uglifier + config.assets.js_compressor = :terser # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass