mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 05:13:43 +08:00
FIX: Ensure sourcemap's source is correct. Uses the full assets path this time. (#8774)
Cherry-picked from 8eb2147f1f
This commit is contained in:
parent
9298132c73
commit
b231be8865
|
@ -75,8 +75,10 @@ end
|
||||||
def compress_node(from, to)
|
def compress_node(from, to)
|
||||||
to_path = "#{assets_path}/#{to}"
|
to_path = "#{assets_path}/#{to}"
|
||||||
assets = cdn_relative_path("/assets")
|
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"
|
source_map_url = cdn_path "/assets/#{to}.map"
|
||||||
|
base_source_map = assets_path + assets_additional_path
|
||||||
|
|
||||||
cmd = if `uglifyjs -V`.match?(/2(.\d*){2}/)
|
cmd = if `uglifyjs -V`.match?(/2(.\d*){2}/)
|
||||||
<<~EOS
|
<<~EOS
|
||||||
|
@ -84,7 +86,7 @@ def compress_node(from, to)
|
||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
<<~EOS
|
<<~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
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user