Skip to content

Commit 03c74c6

Browse files
committed
Port the fix from facebook#3012
2 parents c68882c + 5c010e0 commit 03c74c6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/react-error-overlay/src/containers/StackFrame.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@ class StackFrame extends Component {
9191
} = frame;
9292

9393
// TODO: find a better place for this.
94-
// Chrome has a bug with inferring function.name:
95-
// https://github.com/facebookincubator/create-react-app/issues/2097
96-
// Let's ignore a meaningless name we get for top-level modules.
94+
if (functionName && functionName.indexOf('Object.') === 0) {
95+
functionName = functionName.slice('Object.'.length);
96+
}
9797
if (
98-
functionName === 'Object.friendlySyntaxErrorLabel' ||
99-
functionName === 'Object.exports.__esModule' ||
100-
functionName === 'Object.<anonymous>' ||
98+
// Chrome has a bug with inferring function.name:
99+
// https://github.com/facebookincubator/create-react-app/issues/2097
100+
// Let's ignore a meaningless name we get for top-level modules.
101+
functionName === 'friendlySyntaxErrorLabel' ||
102+
functionName === 'exports.__esModule' ||
103+
functionName === '<anonymous>' ||
101104
!functionName
102105
) {
103106
functionName = '(anonymous function)';

0 commit comments

Comments
 (0)