diff --git a/packages/react-error-overlay/src/containers/StackFrame.js b/packages/react-error-overlay/src/containers/StackFrame.js index 6c32c596e6d..3da29f77152 100644 --- a/packages/react-error-overlay/src/containers/StackFrame.js +++ b/packages/react-error-overlay/src/containers/StackFrame.js @@ -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.' || + // 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 === '' || !functionName ) { functionName = '(anonymous function)';