diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index a151d26c5d5ff1..b1abe891f18f0b 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -11,7 +11,6 @@ 'use strict'; import type {ExtendedError} from './Devtools/parseErrorStack'; -import * as LogBoxData from '../LogBox/Data/LogBoxData'; import type {ExceptionData} from './NativeExceptionsManager'; class SyntheticError extends Error { @@ -104,7 +103,8 @@ function reportException( console.error(data.message); } - if (isHandledByLogBox) { + if (__DEV__ && isHandledByLogBox) { + const LogBoxData = require('../LogBox/Data/LogBoxData'); LogBoxData.addException({ ...data, isComponentError: !!e.isComponentError, diff --git a/Libraries/LogBox/LogBox.js b/Libraries/LogBox/LogBox.js index 92f5133638aa4e..6c489e3e4ea0d8 100644 --- a/Libraries/LogBox/LogBox.js +++ b/Libraries/LogBox/LogBox.js @@ -12,8 +12,6 @@ import Platform from '../Utilities/Platform'; import RCTLog from '../Utilities/RCTLog'; -import * as LogBoxData from './Data/LogBoxData'; -import {parseLogBoxLog, parseInterpolation} from './Data/parseLogBoxLog'; import type {IgnorePattern} from './Data/LogBoxData'; @@ -23,6 +21,9 @@ let LogBox; * LogBox displays logs in the app. */ if (__DEV__) { + const LogBoxData = require('./Data/LogBoxData'); + const {parseLogBoxLog, parseInterpolation} = require('./Data/parseLogBoxLog'); + // LogBox needs to insert itself early, // in order to access the component stacks appended by React DevTools. const {error, warn} = console;