Skip to content

Commit

Permalink
Port the fix from facebook#3012
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Aug 26, 2017
2 parents c68882c + 5c010e0 commit 03c74c6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/react-error-overlay/src/containers/StackFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ class StackFrame extends Component {
} = frame;

// TODO: find a better place for this.
// Chrome has a bug with inferring function.name:
// https://github.com/facebookincubator/create-react-app/issues/2097
// Let's ignore a meaningless name we get for top-level modules.
if (functionName && functionName.indexOf('Object.') === 0) {
functionName = functionName.slice('Object.'.length);
}
if (
functionName === 'Object.friendlySyntaxErrorLabel' ||
functionName === 'Object.exports.__esModule' ||
functionName === 'Object.<anonymous>' ||
// Chrome has a bug with inferring function.name:
// https://github.com/facebookincubator/create-react-app/issues/2097
// Let's ignore a meaningless name we get for top-level modules.
functionName === 'friendlySyntaxErrorLabel' ||
functionName === 'exports.__esModule' ||
functionName === '<anonymous>' ||
!functionName
) {
functionName = '(anonymous function)';
Expand Down

0 comments on commit 03c74c6

Please sign in to comment.