Skip to content

Commit

Permalink
Turbopack: Decode module component when tracing stack frames
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/turborepo#7682, this fixes `pnpm testonly-dev test/development/basic/hmr.test.ts "should recover from errors in the render function"`
  • Loading branch information
wbinnssmith committed Mar 8, 2024
1 parent bd72f39 commit 2ae6a3f
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 2ae6a3f

Please sign in to comment.