Skip to content

Commit 97026d0

Browse files
committed
Don't assume a React environment name matches \w+
1 parent 34a05f2 commit 97026d0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/next/src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ export function getOriginalStackFrames(
103103
}
104104

105105
const webpackRegExes = [
106-
/^(rsc:\/\/React\/\w+\/)?webpack-internal:\/\/\/(\.)?(\((\w+)\))?/,
106+
/^(rsc:\/\/React\/[^/]+\/)?webpack-internal:\/\/\/(\.)?(\((\w+)\))?/,
107107
/^(webpack:\/\/\/(\.)?|webpack:\/\/(_N_E\/)?)(\((\w+)\))?/,
108108
]
109109

110110
const replacementRegExes = [
111-
/^(rsc:\/\/React\/\w+\/)/,
111+
/^(rsc:\/\/React\/[^/]+\/)/,
112112
/^webpack-internal:\/\/\/(\.)?(\((\w+)\))?/,
113113
/^(webpack:\/\/\/(\.)?|webpack:\/\/(_N_E\/)?)(\((\w+)\))?/,
114114
/\?\d+$/, // React's fakeFunctionIdx query param

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function createStackFrame(searchParams: URLSearchParams) {
6969

7070
// rsc://React/Server/file://<filename>?42 => file://<filename>
7171
const file = fileParam
72-
.replace(/^rsc:\/\/React\/\w+\//, '')
72+
.replace(/^rsc:\/\/React\/[^/]+\//, '')
7373
.replace(/\?\d+$/, '')
7474

7575
return {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export async function getSource(
226226
// webpack://_N_E/./src/hello.tsx => ./src/hello.tsx
227227
const moduleId = filename
228228
.replace(
229-
/^(rsc:\/\/React\/\w+\/)?(webpack-internal:\/\/\/|webpack:\/\/(_N_E\/)?)/,
229+
/^(rsc:\/\/React\/[^/]+\/)?(webpack-internal:\/\/\/|webpack:\/\/(_N_E\/)?)/,
230230
''
231231
)
232232
.replace(/\?\d+$/, '')
@@ -277,7 +277,7 @@ export function getOverlayMiddleware(options: {
277277

278278
if (
279279
!(
280-
/^(rsc:\/\/React\/\w+\/)?(webpack-internal:\/\/\/|(file|webpack):\/\/)/.test(
280+
/^(rsc:\/\/React\/[^/]+\/)?(webpack-internal:\/\/\/|(file|webpack):\/\/)/.test(
281281
frame.file
282282
) && frame.lineNumber
283283
)

0 commit comments

Comments
 (0)