From 397b5ae949fcd150aa162065fcf246eeebddbf6d Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Tue, 10 Oct 2017 23:01:49 -0400 Subject: [PATCH] Add a warning when running minified --- packages/react-error-overlay/src/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/react-error-overlay/src/index.js b/packages/react-error-overlay/src/index.js index a800595cffb..1cccd49d8c3 100644 --- a/packages/react-error-overlay/src/index.js +++ b/packages/react-error-overlay/src/index.js @@ -167,3 +167,15 @@ window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = function iframeReady() isLoadingIframe = false; updateIframeContent(); }; + +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. 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.' + ); +}