Skip to content

Commit e5beec7

Browse files
committed
[sourcemaps] Ignore-list Webpack runtime in production sourcemaps
1 parent 01c8b5e commit e5beec7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/next/src/build/webpack/plugins/devtools-ignore-list-plugin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ function defaultIsSourceMapAsset(name: string): boolean {
3131
return name.endsWith('.map')
3232
}
3333

34+
function isWebpackRuntimeModule(modulePath: string): boolean {
35+
// webpack:///webpack/bootstrap
36+
// webpack://_N_E/webpack/
37+
// webpack://someOtherLibrary/webpack/
38+
return /^webpack:\/\/([^/]*)\/webpack/.test(modulePath)
39+
}
40+
3441
/**
3542
* This plugin adds a field to source maps that identifies which sources are
3643
* vendored or runtime-injected (aka third-party) sources. These are consumed by
@@ -77,6 +84,10 @@ export default class DevToolsIgnorePlugin {
7784
for (const [index, path] of sourcemap.sources.entries()) {
7885
if (this.options.shouldIgnorePath(path)) {
7986
ignoreList.push(index)
87+
} else if (isWebpackRuntimeModule(path)) {
88+
// Just like our EvalSourceMapDevToolPlugin ignore-lists Webpack
89+
// runtime by default, we do the same here.
90+
ignoreList.push(index)
8091
}
8192
}
8293

0 commit comments

Comments
 (0)