Commit 591ac1ef authored by Tobias Koppers's avatar Tobias Koppers Committed by Tobias Koppers

Turbopack: unignore module evaluation frames at the start

parent 56364001
...@@ -164,6 +164,25 @@ function ignoreListAnonymousStackFramesIfSandwiched( ...@@ -164,6 +164,25 @@ function ignoreListAnonymousStackFramesIfSandwiched(
) )
} }
function unignoreModuleEvaluationFramesIfLeading(
sourceMappedFrames: Array<{
stack: IgnorableStackFrame
code: string | null
}>
): void {
// Un-ignore "module evaluation" frames at the top of the stack
// when there are no non-ignored frames before them.
// These frames represent meaningful error locations during module initialization.
for (const frame of sourceMappedFrames) {
if (!frame.stack.ignored) {
break
}
if (frame.stack.methodName === 'module evaluation') {
frame.stack.ignored = false
}
}
}
/** /**
* @param frame * @param frame
* @param sourceMapCache * @param sourceMapCache
...@@ -418,6 +437,7 @@ function parseAndSourceMap( ...@@ -418,6 +437,7 @@ function parseAndSourceMap(
} }
ignoreListAnonymousStackFramesIfSandwiched(sourceMappedFrames) ignoreListAnonymousStackFramesIfSandwiched(sourceMappedFrames)
unignoreModuleEvaluationFramesIfLeading(sourceMappedFrames)
let sourceMappedStack = '' let sourceMappedStack = ''
for (let i = 0; i < sourceMappedFrames.length; i++) { for (let i = 0; i < sourceMappedFrames.length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment