Skip to content

Commit a09950e

Browse files
authored
Gate inlined consoleWithStackDev transpilation (#30317)
This code is getting deleted in #30313 anyway but it should've been gated all along. This code exists to basically manually transpile console.error to consoleWithStackDev because the transpiler doesn't work on `.apply` or `.bind` or the dynamic look up. We only apply the transform in DEV so we should've only done this in DEV. Otherwise these logs get silenced in prod.
1 parent a5cc797 commit a09950e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

packages/react-client/src/ReactClientConsoleConfigBrowser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export function printToConsole(
6565
);
6666
}
6767

68-
if (methodName === 'error') {
68+
if (methodName === 'error' && __DEV__) {
6969
error.apply(console, newArgs);
70-
} else if (methodName === 'warn') {
70+
} else if (methodName === 'warn' && __DEV__) {
7171
warn.apply(console, newArgs);
7272
} else {
7373
// $FlowFixMe[invalid-computed-prop]

packages/react-client/src/ReactClientConsoleConfigPlain.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export function printToConsole(
4646
newArgs.splice(offset, 0, badgeFormat, pad + badgeName + pad);
4747
}
4848

49-
if (methodName === 'error') {
49+
if (methodName === 'error' && __DEV__) {
5050
error.apply(console, newArgs);
51-
} else if (methodName === 'warn') {
51+
} else if (methodName === 'warn' && __DEV__) {
5252
warn.apply(console, newArgs);
5353
} else {
5454
// $FlowFixMe[invalid-computed-prop]

packages/react-client/src/ReactClientConsoleConfigServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export function printToConsole(
6666
);
6767
}
6868

69-
if (methodName === 'error') {
69+
if (methodName === 'error' && __DEV__) {
7070
error.apply(console, newArgs);
71-
} else if (methodName === 'warn') {
71+
} else if (methodName === 'warn' && __DEV__) {
7272
warn.apply(console, newArgs);
7373
} else {
7474
// $FlowFixMe[invalid-computed-prop]

0 commit comments

Comments
 (0)