Skip to content

Commit c17426c

Browse files
committed
use regex for rewrite sources
1 parent cfdf388 commit c17426c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/nextjs/src/config/getBuildPluginOptions.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,7 @@ function shouldSkipSourcemapUpload(buildTool: BuildTool, useRunAfterProductionCo
185185
* Source rewriting function for webpack sources
186186
*/
187187
function rewriteWebpackSources(source: string): string {
188-
if (source.startsWith('webpack://_N_E/')) {
189-
return source.replace('webpack://_N_E/', '');
190-
} else if (source.startsWith('webpack://')) {
191-
return source.replace('webpack://', '');
192-
} else {
193-
return source;
194-
}
188+
return source.replace(/^webpack:\/\/(?:_N_E\/)?/, '');
195189
}
196190

197191
/**

0 commit comments

Comments
 (0)