@@ -7,7 +7,6 @@ import { isNextRouterError } from '../components/is-next-router-error'
7
7
import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'
8
8
import { reportGlobalError } from './report-global-error'
9
9
import { originConsoleError } from '../components/globals/intercept-console-error'
10
- import { AppDevOverlayErrorBoundary } from '../components/react-dev-overlay/app/app-dev-overlay-error-boundary'
11
10
import {
12
11
ErrorBoundaryHandler ,
13
12
GlobalError as DefaultErrorBoundary ,
@@ -19,12 +18,22 @@ export function onCaughtError(
19
18
) {
20
19
const errorBoundaryComponent = errorInfo . errorBoundary ?. constructor
21
20
22
- const isImplicitErrorBoundary =
23
- ( process . env . NODE_ENV !== 'production' &&
24
- errorBoundaryComponent === AppDevOverlayErrorBoundary ) ||
21
+ let isImplicitErrorBoundary
22
+
23
+ if ( process . env . NODE_ENV !== 'production' ) {
24
+ const { AppDevOverlayErrorBoundary } =
25
+ require ( '../components/react-dev-overlay/app/app-dev-overlay-error-boundary' ) as typeof import ( '../components/react-dev-overlay/app/app-dev-overlay-error-boundary' )
26
+
27
+ isImplicitErrorBoundary =
28
+ errorBoundaryComponent === AppDevOverlayErrorBoundary
29
+ }
30
+
31
+ isImplicitErrorBoundary =
32
+ isImplicitErrorBoundary ||
25
33
( errorBoundaryComponent === ErrorBoundaryHandler &&
26
34
( errorInfo . errorBoundary ! as InstanceType < typeof ErrorBoundaryHandler > )
27
35
. props . errorComponent === DefaultErrorBoundary )
36
+
28
37
if ( isImplicitErrorBoundary ) {
29
38
// We don't consider errors caught unless they're caught by an explicit error
30
39
// boundary. The built-in ones are considered implicit.
0 commit comments