Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update index.js
  • Loading branch information
Timer authored Oct 11, 2017
commit 85109c39d9f04ef2062882781986db80f791ff90
20 changes: 3 additions & 17 deletions packages/react-error-overlay/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,9 @@ window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = function iframeReady()
updateIframeContent();
};

const warningText =
'When deploying an application, `react-error-overlay` should be excluded ' +
'as it is a heavy dependency meant for development.\n\n' +
'Consider adding an error boundary to your tree to customize error ' +
'handling behavior. See https://fb.me/react-error-boundaries for more ' +
'information.';

if (process.env.NODE_ENV !== 'production') {
var testFunc = function testFn() {};
if ((testFunc.name || testFunc.toString()).indexOf('testFn') === -1) {
console.warn(
'It looks like you are using `react-error-overlay` in production. ' +
warningText
);
}
} else {
if (process.env.NODE_ENV === 'production') {
console.warn(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be more severe with console.error, or perhaps throw.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it makes more sense to go with warn as it's technically not an error.

'You are using `react-error-overlay` in production. ' + warningText
'react-error-overlay is not meant for use in production. You should ' +
'ensure it is not included in your build to reduce bundle size.'
);
}