Unverified Commit ab24f622 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[sourcemaps] Don't check for vendor chunks when Node.js 18 is used (#81619)

parent 8f060ea2
import type { SourceMap } from 'module'
function noSourceMap(): SourceMap | undefined {
return undefined
}
// Edge runtime does not implement `module` // Edge runtime does not implement `module`
const findSourceMap = const nativeFindSourceMap =
process.env.NEXT_RUNTIME === 'edge' process.env.NEXT_RUNTIME === 'edge'
? () => undefined ? noSourceMap
: (require('module') as typeof import('module')).findSourceMap : (require('module') as typeof import('module')).findSourceMap
/** /**
...@@ -95,6 +101,13 @@ export function findApplicableSourceMapPayload( ...@@ -95,6 +101,13 @@ export function findApplicableSourceMapPayload(
const didWarnAboutInvalidSourceMapDEV = new Set<string>() const didWarnAboutInvalidSourceMapDEV = new Set<string>()
const findSourceMap: (scriptNameOrSourceURL: string) => SourceMap | undefined =
process.env.NEXT_RUNTIME === 'nodejs' &&
process.versions.node?.startsWith('18')
? // Node.js 18 has a horribly slow `findSourceMap` implementation
noSourceMap
: nativeFindSourceMap
export function filterStackFrameDEV( export function filterStackFrameDEV(
sourceURL: string, sourceURL: string,
functionName: string, functionName: string,
......
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