Skip to content

Commit

Permalink
fix: blob URL sourceURL resolution (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Oct 30, 2024
1 parent 1369428 commit 2ea1e28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/es-module-shims.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,12 @@ function resolveDeps (load, seen) {
const urlStart = commentStart + commentPrefix.length;
const commentEnd = source.indexOf('\n', urlStart);
const urlEnd = commentEnd !== -1 ? commentEnd : source.length;
let sourceUrl = source.slice(urlStart, urlEnd);
try {
sourceUrl = new URL(sourceUrl, load.r).href;
} catch {}
pushStringTo(urlStart);
resolvedSource += new URL(source.slice(urlStart, urlEnd), load.r).href;
resolvedSource += sourceUrl;
lastIndex = urlEnd;
}

Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/es-modules/no-imports.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ea1e28

Please sign in to comment.