Skip to content

Commit

Permalink
Split source map paths as absolute/relative
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorton committed Nov 4, 2024
1 parent 2781167 commit c583d9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/propshaft/compiler/source_mapping_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ def compile(asset, input)

private
def asset_path(source_mapping_url, logical_path)
source_mapping_url = ::File.basename(source_mapping_url)
source_mapping_url.gsub!(/^(.+\/)?#{url_prefix}\//, "/")
source_mapping_path = Pathname.new(source_mapping_url)

if logical_path.dirname.to_s == "."
source_mapping_url
if source_mapping_path.absolute?
source_mapping_url.sub(/^\//, "")
else
logical_path.dirname.join(source_mapping_url).to_s
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var fun; //# sourceMappingURL=/assets/sourceMappingURL-already-prefixed-nested.js.map
var fun; //# sourceMappingURL=/assets/nested/sourceMappingURL-already-prefixed-nested.js.map

0 comments on commit c583d9c

Please sign in to comment.