diff --git a/packages/react-error-overlay/src/components/frame.js b/packages/react-error-overlay/src/components/frame.js index 43d0d4043a3..4087f4d9c9d 100644 --- a/packages/react-error-overlay/src/components/frame.js +++ b/packages/react-error-overlay/src/components/frame.js @@ -101,13 +101,13 @@ function frameDiv( const frame = document.createElement('div'); const frameFunctionName = document.createElement('div'); - let cleanedFunctionName; - if (!functionName || functionName === 'Object.') { - cleanedFunctionName = '(anonymous function)'; - } else { - cleanedFunctionName = functionName; + if (functionName && functionName.indexOf('Object.') === 0) { + functionName = functionName.slice('Object.'.length); } - + if (functionName === '') { + functionName = null; + } + const cleanedFunctionName = functionName || '(anonymous function)'; const cleanedUrl = url.replace('webpack://', '.'); if (internalUrl) {