diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts b/packages/next/src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts index f03bde50c88e0..d8f3e52148688 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts +++ b/packages/next/src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts @@ -103,12 +103,12 @@ export function getOriginalStackFrames( } const webpackRegExes = [ - /^(rsc:\/\/React\/\w+\/)?webpack-internal:\/\/\/(\.)?(\((\w+)\))?/, + /^(rsc:\/\/React\/[^/]+\/)?webpack-internal:\/\/\/(\.)?(\((\w+)\))?/, /^(webpack:\/\/\/(\.)?|webpack:\/\/(_N_E\/)?)(\((\w+)\))?/, ] const replacementRegExes = [ - /^(rsc:\/\/React\/\w+\/)/, + /^(rsc:\/\/React\/[^/]+\/)/, /^webpack-internal:\/\/\/(\.)?(\((\w+)\))?/, /^(webpack:\/\/\/(\.)?|webpack:\/\/(_N_E\/)?)(\((\w+)\))?/, /\?\d+$/, // React's fakeFunctionIdx query param diff --git a/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts b/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts index f2ee747000330..b71aeaba2a493 100644 --- a/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts +++ b/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts @@ -69,7 +69,7 @@ function createStackFrame(searchParams: URLSearchParams) { // rsc://React/Server/file://?42 => file:// const file = fileParam - .replace(/^rsc:\/\/React\/\w+\//, '') + .replace(/^rsc:\/\/React\/[^/]+\//, '') .replace(/\?\d+$/, '') return { diff --git a/packages/next/src/client/components/react-dev-overlay/server/middleware.ts b/packages/next/src/client/components/react-dev-overlay/server/middleware.ts index 9d53c00cbd6fd..37d3724ce5ab8 100644 --- a/packages/next/src/client/components/react-dev-overlay/server/middleware.ts +++ b/packages/next/src/client/components/react-dev-overlay/server/middleware.ts @@ -226,7 +226,7 @@ export async function getSource( // webpack://_N_E/./src/hello.tsx => ./src/hello.tsx const moduleId = filename .replace( - /^(rsc:\/\/React\/\w+\/)?(webpack-internal:\/\/\/|webpack:\/\/(_N_E\/)?)/, + /^(rsc:\/\/React\/[^/]+\/)?(webpack-internal:\/\/\/|webpack:\/\/(_N_E\/)?)/, '' ) .replace(/\?\d+$/, '') @@ -277,7 +277,7 @@ export function getOverlayMiddleware(options: { if ( !( - /^(rsc:\/\/React\/\w+\/)?(webpack-internal:\/\/\/|(file|webpack):\/\/)/.test( + /^(rsc:\/\/React\/[^/]+\/)?(webpack-internal:\/\/\/|(file|webpack):\/\/)/.test( frame.file ) && frame.lineNumber )