Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
907501e8
Unverified
Commit
907501e8
authored
Jul 21, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Jul 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sourcemaps] Try VM for retrieving source maps first (#81869)
parent
c8c9bef3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
middleware-turbopack.ts
packages/next/src/server/dev/middleware-turbopack.ts
+16
-22
No files found.
packages/next/src/server/dev/middleware-turbopack.ts
View file @
907501e8
...
@@ -21,8 +21,7 @@ import {
...
@@ -21,8 +21,7 @@ import {
devirtualizeReactServerURL
,
devirtualizeReactServerURL
,
findApplicableSourceMapPayload
,
findApplicableSourceMapPayload
,
}
from
'../lib/source-maps'
}
from
'../lib/source-maps'
import
{
getSourceMapFromFile
}
from
'./get-source-map-from-file'
import
{
findSourceMap
,
type
SourceMap
}
from
'node:module'
import
{
findSourceMap
}
from
'node:module'
import
{
fileURLToPath
,
pathToFileURL
}
from
'node:url'
import
{
fileURLToPath
,
pathToFileURL
}
from
'node:url'
import
{
inspect
}
from
'node:util'
import
{
inspect
}
from
'node:util'
...
@@ -419,19 +418,22 @@ export function getSourceMapMiddleware(project: Project) {
...
@@ -419,19 +418,22 @@ export function getSourceMapMiddleware(project: Project) {
return
middlewareResponse
.
badRequest
(
res
)
return
middlewareResponse
.
badRequest
(
res
)
}
}
// TODO(veil): Always try the native version first.
let
nativeSourceMap
:
SourceMap
|
undefined
// Externals could also be files that aren't bundled via Webpack.
try
{
if
(
nativeSourceMap
=
findSourceMap
(
filename
)
filename
.
startsWith
(
'webpack://'
)
||
}
catch
(
cause
)
{
filename
.
startsWith
(
'webpack-internal:///'
)
return
middlewareResponse
.
internalServerError
(
)
{
res
,
const
sourceMap
=
findSourceMap
(
filename
)
new
Error
(
`
${
filename
}
: Invalid source map. Only conformant source maps can be used to find the original code.`
,
if
(
sourceMap
)
{
{
cause
}
return
middlewareResponse
.
json
(
res
,
sourceMap
.
payload
)
)
}
)
}
return
middlewareResponse
.
noContent
(
res
)
if
(
nativeSourceMap
!==
undefined
)
{
const
sourceMapPayload
=
nativeSourceMap
.
payload
return
middlewareResponse
.
json
(
res
,
sourceMapPayload
)
}
}
try
{
try
{
...
@@ -451,14 +453,6 @@ export function getSourceMapMiddleware(project: Project) {
...
@@ -451,14 +453,6 @@ export function getSourceMapMiddleware(project: Project) {
if
(
sourceMapString
)
{
if
(
sourceMapString
)
{
return
middlewareResponse
.
jsonString
(
res
,
sourceMapString
)
return
middlewareResponse
.
jsonString
(
res
,
sourceMapString
)
}
}
if
(
filename
.
startsWith
(
'file:'
))
{
const
sourceMap
=
await
getSourceMapFromFile
(
filename
)
if
(
sourceMap
)
{
return
middlewareResponse
.
json
(
res
,
sourceMap
)
}
}
}
catch
(
cause
)
{
}
catch
(
cause
)
{
return
middlewareResponse
.
internalServerError
(
return
middlewareResponse
.
internalServerError
(
res
,
res
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment