Skip to content
Permalink
Browse files
RN: Console Stub Parity
Summary:
Brings parity to the non-`__DEV__` stub polyfill for `console`.

Changelog:
[General][Added] - Added missing `console` polyfills in release builds.

Reviewed By: ejanzer, RSNara

Differential Revision: D18667335

fbshipit-source-id: 0307d04a136e5f7bb914f18b80441b7a7fae5e5b
  • Loading branch information
yungsters authored and facebook-github-bot committed Nov 23, 2019
1 parent ac3c167 commit b7ab922bb3fd4f9f103e583bed9e9295a9521578
Showing 1 changed file with 19 additions and 4 deletions.
@@ -615,15 +615,30 @@ if (global.nativeLoggingHook) {
});
}
} else if (!global.console) {
const log = global.print || function consoleLoggingStub() {};
function stub() {}
const log = global.print || stub;

global.console = {
debug: log,
error: log,
info: log,
log: log,
warn: log,
trace: log,
debug: log,
table: log,
warn: log,
assert(expression, label) {
if (!expression) {
log('Assertion failed: ' + label);
}
},
clear: stub,
dir: stub,
dirxml: stub,
group: stub,
groupCollapsed: stub,
groupEnd: stub,
profile: stub,
profileEnd: stub,
table: stub,
};

Object.defineProperty(console, '_isPolyfilled', {

0 comments on commit b7ab922

Please sign in to comment.