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
270744b7
Unverified
Commit
270744b7
authored
Jun 10, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Jun 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[build-sourcemaps] Only compute codeframe once (#80326)
parent
e74a8245
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
patch-error-inspect.ts
packages/next/src/server/patch-error-inspect.ts
+28
-17
No files found.
packages/next/src/server/patch-error-inspect.ts
View file @
270744b7
...
@@ -275,12 +275,6 @@ function getSourcemappedFrameIfPossible(
...
@@ -275,12 +275,6 @@ function getSourcemappedFrameIfPossible(
}
}
}
}
const
sourceContent
:
string
|
null
=
sourceMapConsumer
.
sourceContentFor
(
sourcePosition
.
source
,
/* returnNullOnMissing */
true
)
??
null
const
applicableSourceMap
=
findApplicableSourceMapPayload
(
const
applicableSourceMap
=
findApplicableSourceMapPayload
(
frame
,
frame
,
sourceMapPayload
sourceMapPayload
...
@@ -321,16 +315,33 @@ function getSourcemappedFrameIfPossible(
...
@@ -321,16 +315,33 @@ function getSourcemappedFrameIfPossible(
ignored
,
ignored
,
}
}
const
codeFrame
=
getOriginalCodeFrame
(
/** undefined = not yet computed*/
let
codeFrame
:
string
|
null
|
undefined
return
Object
.
defineProperty
(
{
stack
:
originalFrame
,
code
:
null
,
},
'code'
,
{
get
:
()
=>
{
if
(
codeFrame
===
undefined
)
{
const
sourceContent
:
string
|
null
=
sourceMapConsumer
.
sourceContentFor
(
sourcePosition
.
source
,
/* returnNullOnMissing */
true
)
??
null
codeFrame
=
getOriginalCodeFrame
(
originalFrame
,
originalFrame
,
sourceContent
,
sourceContent
,
inspectOptions
.
colors
inspectOptions
.
colors
)
)
return
{
stack
:
originalFrame
,
code
:
codeFrame
,
}
}
return
codeFrame
},
}
)
}
}
function
parseAndSourceMap
(
function
parseAndSourceMap
(
...
@@ -372,10 +383,10 @@ function parseAndSourceMap(
...
@@ -372,10 +383,10 @@ function parseAndSourceMap(
)
)
if
(
if
(
sourcemappedFrame
.
code
!==
null
&&
sourceFrame
===
null
&&
sourceFrame
===
null
&&
// TODO: Is this the right choice?
// TODO: Is this the right choice?
!
sourcemappedFrame
.
stack
.
ignored
!
sourcemappedFrame
.
stack
.
ignored
&&
sourcemappedFrame
.
code
!==
null
)
{
)
{
sourceFrame
=
sourcemappedFrame
.
code
sourceFrame
=
sourcemappedFrame
.
code
}
}
...
...
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