From 8eb2147f1fe3d69ecb225f4c731bdb65f6e8ff32 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Thu, 23 Jan 2020 14:44:00 -0300 Subject: [PATCH] FIX: Ensure sourcemap's source is correct. Uses the full assets path this time. (#8774) --- lib/tasks/assets.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index a1c73977811..4261d69450b 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -75,11 +75,13 @@ end def compress_node(from, to) to_path = "#{assets_path}/#{to}" assets = cdn_relative_path("/assets") - source_map_root = assets + ((d = File.dirname(from)) == "." ? "" : "/#{d}") + assets_additional_path = (d = File.dirname(from)) == "." ? "" : "/#{d}" + source_map_root = assets + assets_additional_path source_map_url = cdn_path "/assets/#{to}.map" + base_source_map = assets_path + assets_additional_path cmd = <<~EOS - uglifyjs '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "root='#{source_map_root}',url='#{source_map_url}'" --output '#{to_path}' + uglifyjs '#{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