Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,7 @@ pub async fn get_server_chunking_context_with_client_assets(
builder = builder.source_map_source_type(if next_mode.is_development() {
SourceMapSourceType::AbsoluteFileUri
} else {
// TODO(lukesandberg): switch to relative once next is compatible.
SourceMapSourceType::TurbopackUri
SourceMapSourceType::RelativeUri
});
if next_mode.is_production() {
builder = builder
Expand Down Expand Up @@ -1149,8 +1148,7 @@ pub async fn get_server_chunking_context(
builder = builder.source_map_source_type(SourceMapSourceType::AbsoluteFileUri);
} else {
builder = builder
// TODO(lukesandberg): switch to relative once next is compatible.
.source_map_source_type(SourceMapSourceType::TurbopackUri)
.source_map_source_type(SourceMapSourceType::RelativeUri)
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
Expand Down
11 changes: 9 additions & 2 deletions packages/next/src/server/patch-error-inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,16 @@ function getSourcemappedFrameIfPossible(
}
sourceMapPayload = maybeSourceMapPayload
try {
// Pass the source map URL as the second parameter so that the consumer
// can resolve relative paths in the source map's `sources` array.
// This is a guess! Turbopack places .map files as siblings to the chunks so this is sufficient to compute
// relative paths but is actually wrong (the chunk and sourcemap have different content hashes).
// We are using the node API to read the sourcemap and it doesn't give us access to the URI.
const sourceMapURL = sourceURL + '.map'
sourceMapConsumer = new SyncSourceMapConsumer(
// @ts-expect-error -- Module.SourceMap['version'] is number but SyncSourceMapConsumer wants a string
sourceMapPayload
sourceMapPayload,
// @ts-expect-error: our typings don't include this parameter but it is here.
sourceMapURL
)
} catch (cause) {
// We should not log an actual error instance here because that will re-enter
Expand Down
Loading
Loading