Skip to content

Commit

Permalink
Turbopack: Decode module component when tracing stack frames (#63070)
Browse files Browse the repository at this point in the history
In addition to the file path, also url-decode the module name
(represented by the `id` query parameter).

Test Plan: Together with vercel/turbo#7682, this fixes `pnpm
testonly-dev test/development/basic/hmr.test.ts "should recover from
errors in the render function"`


Closes PACK-2700
  • Loading branch information
wbinnssmith committed Mar 9, 2024
1 parent a2457c9 commit 274c4b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/next-swc/crates/napi/src/next_api/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,13 @@ pub async fn project_trace_source(
"file" => {
let path = urlencoding::decode(url.path())?.to_string();
let module = url.query_pairs().find(|(k, _)| k == "id");
(path, module.map(|(_, m)| m.into_owned()))
(
path,
match module {
Some(module) => Some(urlencoding::decode(&module.1)?.into_owned()),
None => None,
},
)
}
_ => bail!("Unknown url scheme"),
},
Expand Down

0 comments on commit 274c4b7

Please sign in to comment.