From fcae4a8fafbf46f3a25bcd3fc89605dd1fc1243d Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 10 Feb 2022 15:37:44 +0000 Subject: [PATCH] DEV: Do not include CDN domain in the sourceMappingURL (#15887) If no path is supplied, browsers will look for the map on the same path as the JS file itself. This fixes two problems that we see in production: 1. When compiling assets against one CDN, and then re-using them on a site with a different CDN, the sourceMappingUrls would be incorrect and print warnings in the console 2. If both an S3 CDN and an app CDN are configured, we were using the S3 CDN for the JS and the app CDN for the map. This commit will make sure we use the S3 CDN for both. --- lib/tasks/assets.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index d10fd89779..9288fa499e 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -109,7 +109,7 @@ def compress_node(from, to) assets = cdn_relative_path("/assets") assets_additional_path = (d = File.dirname(from)) == "." ? "" : "/#{d}" source_map_root = assets + assets_additional_path - source_map_url = cdn_path "/assets/#{to}.map" + source_map_url = "#{File.basename(to)}.map" base_source_map = assets_path + assets_additional_path cmd = <<~EOS