Skip to content

Commit dec0ebe

Browse files
authored
Webpack: handle file:// urls when finding sourcemaps (#76443)
Previously we only handled the eval sourcemaps case where the module id was encoded into the source url. This handles cases when the `file://` protocol is used, such as with Rspack. Test Plan: `pnpm test-dev-rspack test/development/acceptance-app/rsc-runtime-errors.test.ts`
1 parent 121306d commit dec0ebe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/next/src/client/components/react-dev-overlay/server/middleware-webpack.ts

+3
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ async function getSource(
287287
): Promise<Source | undefined> {
288288
const { getCompilations } = options
289289

290+
// Rspack is now using file:// URLs for source maps. Remove the rsc prefix to produce the file:/// url.
291+
sourceURL = sourceURL.replace(/(.*)\/(?=file:\/\/)/, '')
292+
290293
let nativeSourceMap: SourceMap | undefined
291294
try {
292295
nativeSourceMap = findSourceMap(sourceURL)

0 commit comments

Comments
 (0)