Skip to content

Commit

Permalink
Gate inlined consoleWithStackDev transpilation (#30317)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebmarkbage authored Jul 11, 2024
1 parent a5cc797 commit a09950e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export function printToConsole(
);
}

if (methodName === 'error') {
if (methodName === 'error' && __DEV__) {
error.apply(console, newArgs);
} else if (methodName === 'warn') {
} else if (methodName === 'warn' && __DEV__) {
warn.apply(console, newArgs);
} else {
// $FlowFixMe[invalid-computed-prop]
Expand Down
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigPlain.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export function printToConsole(
newArgs.splice(offset, 0, badgeFormat, pad + badgeName + pad);
}

if (methodName === 'error') {
if (methodName === 'error' && __DEV__) {
error.apply(console, newArgs);
} else if (methodName === 'warn') {
} else if (methodName === 'warn' && __DEV__) {
warn.apply(console, newArgs);
} else {
// $FlowFixMe[invalid-computed-prop]
Expand Down
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ export function printToConsole(
);
}

if (methodName === 'error') {
if (methodName === 'error' && __DEV__) {
error.apply(console, newArgs);
} else if (methodName === 'warn') {
} else if (methodName === 'warn' && __DEV__) {
warn.apply(console, newArgs);
} else {
// $FlowFixMe[invalid-computed-prop]
Expand Down

0 comments on commit a09950e

Please sign in to comment.