File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
packages/react-error-overlay/src Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -168,14 +168,23 @@ window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = function iframeReady()
168168 updateIframeContent ( ) ;
169169} ;
170170
171- var testFunc = function testFn ( ) { } ;
172- if ( ( testFunc . name || testFunc . toString ( ) ) . indexOf ( 'testFn' ) !== - 1 ) {
171+ const warningText =
172+ 'When deploying an application, `react-error-overlay` should be excluded ' +
173+ 'as it is a heavy dependency meant for development.\n\n' +
174+ 'Consider adding an error boundary to your tree to customize error ' +
175+ 'handling behavior. See https://fb.me/react-error-boundaries for more ' +
176+ 'information.' ;
177+
178+ if ( process . env . NODE_ENV !== 'production' ) {
179+ var testFunc = function testFn ( ) { } ;
180+ if ( ( testFunc . name || testFunc . toString ( ) ) . indexOf ( 'testFn' ) === - 1 ) {
181+ console . warn (
182+ 'It looks like you are using `react-error-overlay` in production. ' +
183+ warningText
184+ ) ;
185+ }
186+ } else {
173187 console . warn (
174- 'It looks like you are using `react-error-overlay` in production. When ' +
175- 'deploying an application, `react-error-overlay` should be excluded ' +
176- 'as it is a heavy dependency meant for development.\n\n' +
177- 'Consider adding an error boundary to your tree to customize error ' +
178- 'handling behavior. See https://fb.me/react-error-boundaries for more ' +
179- 'information.'
188+ 'You are using `react-error-overlay` in production. ' + warningText
180189 ) ;
181190}
You can’t perform that action at this time.
0 commit comments