FIX: Use Terser for minification even if uglify-js is not available (#13683)

FIX: Use Terser for minification even if uglify-js is not available (#13683)

diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 41ab8ab..69f8b3f 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -18,7 +18,7 @@ task 'assets:precompile:before' do
   # is recompiled
   Emoji.clear_cache
 
-  if !`which uglifyjs`.empty? && !ENV['SKIP_NODE_UGLIFY']
+  if !`which terser`.empty? && !ENV['SKIP_NODE_UGLIFY']
     $node_uglify = true
   end
 
@@ -102,11 +102,8 @@ def compress_node(from, to)
   source_map_url = cdn_path "/assets/#{to}.map"
   base_source_map = assets_path + assets_additional_path
 
-  # TODO: Remove uglifyjs when base image only includes terser
-  js_compressor = `which terser`.empty? ? 'uglifyjs' : 'terser'
-
   cmd = <<~EOS
-    #{js_compressor} '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}'"
+    terser '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}'"
   EOS
 
   STDERR.puts cmd

GitHub sha: 7e52eada200627b2f224c7980c8ed51d77f42028

This commit appears in #13683 which was approved by pmusaraj and tgxworld. It was merged by tgxworld.