From 7e52eada200627b2f224c7980c8ed51d77f42028 Mon Sep 17 00:00:00 2001 From: Kim Lindberger Date: Wed, 14 Jul 2021 08:20:57 +0200 Subject: [PATCH] FIX: Use Terser for minification even if uglify-js is not available (#13683) --- lib/tasks/assets.rake | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 41ab8ab28ca..69f8b3f75c0 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