From 6457d842949fec2585eedcb0673458a91a6db4ea Mon Sep 17 00:00:00 2001
From: Taico Aerts <t.v.aerts@tudelft.nl>
Date: Sun, 4 Sep 2022 15:46:07 +0200
Subject: [PATCH] Switch to terser for js compression

---
 Gemfile                           | 2 +-
 Gemfile.lock                      | 6 +++---
 config/environments/production.rb | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Gemfile b/Gemfile
index e85096407..dc3cc5d36 100644
--- a/Gemfile
+++ b/Gemfile
@@ -17,7 +17,7 @@ gem 'sass-rails', '~> 6.0'
 gem 'sprockets', '~> 4.1'
 gem 'sprockets-rails', '~> 3.4', require: 'sprockets/railtie'
 gem 'tzinfo-data', '~> 1.2022.3'
-gem 'uglifier', '>= 4.2.0'
+gem 'terser', '~> 1.1'
 
 # Sign in
 gem 'devise', '~> 4.8'
diff --git a/Gemfile.lock b/Gemfile.lock
index 276c1b250..74778fee9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -324,6 +324,8 @@ GEM
     sync (0.5.0)
     term-ansicolor (1.7.1)
       tins (~> 1.0)
+    terser (1.1.12)
+      execjs (>= 0.3.0, < 3)
     thor (1.2.1)
     thwait (0.2.0)
       e2mmap
@@ -335,8 +337,6 @@ GEM
       concurrent-ruby (~> 1.0)
     tzinfo-data (1.2022.3)
       tzinfo (>= 1.0.0)
-    uglifier (4.2.0)
-      execjs (>= 0.3.0, < 3)
     unicode-display_width (2.2.0)
     warden (1.2.9)
       rack (>= 2.0.9)
@@ -408,9 +408,9 @@ DEPENDENCIES
   stackprof (~> 0.2)
   stripe (~> 5.55)
   term-ansicolor (~> 1.7)
+  terser (~> 1.1)
   thwait (~> 0.2)
   tzinfo-data (~> 1.2022.3)
-  uglifier (>= 4.2.0)
   web-console (~> 4.2)
   whenever (~> 1.0)
   will_paginate (~> 3.3)
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 9c7b0af04..f86b8ec2f 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -26,7 +26,7 @@ Rails.application.configure do
   config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
 
   # Compress JavaScripts and CSS.
-  config.assets.js_compressor = Uglifier.new(harmony: true)
+  config.assets.js_compressor = Terser.new
   # Compress CSS using a preprocessor.
   # config.assets.css_compressor = :sass
 
-- 
GitLab