diff --git a/packager/react-packager/src/DependencyResolver/polyfills/console.js b/packager/react-packager/src/DependencyResolver/polyfills/console.js index e841aebb8..b6f20c761 100644 --- a/packager/react-packager/src/DependencyResolver/polyfills/console.js +++ b/packager/react-packager/src/DependencyResolver/polyfills/console.js @@ -468,13 +468,17 @@ // If available, also call the original `console` method since that is // sometimes useful. Ex: on OS X, this will let you see rich output in // the Safari Web Inspector console. - Object.keys(global.console).forEach(methodName => { - var reactNativeMethod = global.console[methodName]; - global.console[methodName] = function() { - originalConsole[methodName](...arguments); - reactNativeMethod.apply(global.console, arguments); - }; - }); + if (__DEV__ && originalConsole) { + Object.keys(global.console).forEach(methodName => { + var reactNativeMethod = global.console[methodName]; + if (originalConsole[methodName]) { + global.console[methodName] = function() { + originalConsole[methodName](...arguments); + reactNativeMethod.apply(global.console, arguments); + }; + } + }); + } } if (typeof module !== 'undefined') {