Skip to content

Commit

Permalink
Turbopack HMR: url-encode sourceURLs (#7682)
Browse files Browse the repository at this point in the history
Previously, URLs with spaces (such as those with `[root of dev server]`)
were not understood by tools like Chrome’s dev tools.

Test Plan: Test with an upcoming Next.js PR (to be linked below)


Closes PACK-2699
  • Loading branch information
wbinnssmith committed Mar 9, 2024
1 parent 952d30a commit df0fcbb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ async function loadWebAssemblyModule(
})();

function _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {
code += `\n\n//# sourceURL=${location.origin}/${CHUNK_BASE_PATH}${url}`;
code += `\n\n//# sourceURL=${encodeURI(
location.origin + CHUNK_BASE_PATH + url
)}`;
if (map)
code += `\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(
map
Expand Down

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

Large diffs are not rendered by default.

0 comments on commit df0fcbb

Please sign in to comment.