Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
738de016
Unverified
Commit
738de016
authored
Dec 07, 2022
by
Hannes Bornö
Committed by
GitHub
Dec 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `__webpack_exports__` from error overlay (#43715)
parent
ba19ce37
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
middleware.ts
packages/react-dev-overlay/src/middleware.ts
+3
-1
ReactRefreshLogBox.test.ts
test/development/acceptance-app/ReactRefreshLogBox.test.ts
+23
-0
ReactRefreshLogBox.test.ts.snap
...eptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap
+12
-0
No files found.
packages/react-dev-overlay/src/middleware.ts
View file @
738de016
...
...
@@ -216,7 +216,9 @@ export async function createOriginalStackFrame({
sourcePosition
.
name
||
// default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export
// Resolve it back to `default` for the method name if the source position didn't have the method.
frame
.
methodName
?.
replace
(
'__WEBPACK_DEFAULT_EXPORT__'
,
'default'
),
frame
.
methodName
?.
replace
(
'__WEBPACK_DEFAULT_EXPORT__'
,
'default'
)
?.
replace
(
'__webpack_exports__.'
,
''
),
arguments
:
[],
}
...
...
test/development/acceptance-app/ReactRefreshLogBox.test.ts
View file @
738de016
...
...
@@ -1062,4 +1062,27 @@ describe('ReactRefreshLogBox app', () => {
await
cleanup
()
})
test
(
'Should not show __webpack_exports__ when exporting anonymous arrow function'
,
async
()
=>
{
const
{
session
,
cleanup
}
=
await
sandbox
(
next
)
await
session
.
patch
(
'index.js'
,
`
export default () => {
if (typeof window !== 'undefined') {
throw new Error('test')
}
return null
}
`
)
expect
(
await
session
.
hasRedbox
(
true
)).
toBe
(
true
)
expect
(
await
session
.
getRedboxSource
()).
toMatchSnapshot
()
await
cleanup
()
})
})
test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap
View file @
738de016
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox app Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = `
"index.js (4:16) @ default
2 | export default () => {
3 | if (typeof window !== 'undefined') {
> 4 | throw new Error('test')
| ^
5 | }
6 |
7 | return null"
`;
exports[`ReactRefreshLogBox app boundaries 1`] = `
"FunctionDefault.js (1:50) @ FunctionDefault
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment