-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix next.js source map resolving #4062
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
7 Ignored Deployments
|
🟢 CI successful 🟢Thanks |
Benchmark for 7c95dbcClick to view benchmark
|
Benchmark for de72e6eClick to view benchmark
|
@@ -81,7 +78,15 @@ impl ContentSource for NextSourceMapTraceContentSource { | |||
self_vc.await?.asset_source, | |||
NextSourceMapTraceContentProcessorVc::new(id, line, column, frame.name).into(), | |||
); | |||
Ok(wrapped.as_content_source().get(path, Default::default())) | |||
Ok(ContentSourceResultVc::exact( | |||
ContentSourceContent::Rewrite( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why these need to be rewrites. We're not expecting query params, right? We're not changing headers. This should be equivalent to just doing the .get()
directly, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are changing the path
, which is also reflected in the url
in data.
Benchmark for 44b8189
Click to view full benchmark
|
@@ -27,6 +27,7 @@ turbopack-core = { workspace = true } | |||
turbopack-dev-server = { workspace = true } | |||
turbopack-ecmascript = { workspace = true } | |||
url = { workspace = true } | |||
urlencoding = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urlencoding = { workspace = true } |
@@ -40,6 +42,17 @@ impl SourceMapContentSourceVc { | |||
} | |||
} | |||
|
|||
fn encode_pathname_to_url(pathname: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment on why we need to encode the pieces between /
s?
# New Features - vercel/turborepo#3975 # Bug Fixes - vercel/turborepo#4129 - vercel/turborepo#4134 - vercel/turborepo#4062 # Performance - vercel/turborepo#4093
### Description Before the error overlay didn't show the source mapped file. Now it does. * The wrapped ContentSources need to wrap a Rewrite result. * Instead of returning a ContentSourceResult from a different ContentSource, one need to use Rewrite to get the data correct. ### Testing Instructions Throw an error in an next.js app that triggers the error overlay with stack trace.
### Description Before the error overlay didn't show the source mapped file. Now it does. * The wrapped ContentSources need to wrap a Rewrite result. * Instead of returning a ContentSourceResult from a different ContentSource, one need to use Rewrite to get the data correct. ### Testing Instructions Throw an error in an next.js app that triggers the error overlay with stack trace.
### Description Before the error overlay didn't show the source mapped file. Now it does. * The wrapped ContentSources need to wrap a Rewrite result. * Instead of returning a ContentSourceResult from a different ContentSource, one need to use Rewrite to get the data correct. ### Testing Instructions Throw an error in an next.js app that triggers the error overlay with stack trace.
Description
Before the error overlay didn't show the source mapped file.
Now it does.
Testing Instructions
Throw an error in an next.js app that triggers the error overlay with stack trace.