-
Notifications
You must be signed in to change notification settings - Fork 46.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable consoleWithStackDev Transform except in RN/WWW #30313
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
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. DiffTrain build for [a09950e](a09950e)
6983e94
to
8411d18
Compare
if (methodName === 'error' && __DEV__) { | ||
error.apply(console, newArgs); | ||
} else if (methodName === 'warn' && __DEV__) { | ||
warn.apply(console, newArgs); | ||
} else { | ||
// $FlowFixMe[invalid-computed-prop] | ||
console[methodName].apply(console, newArgs); // eslint-disable-line react-internal/no-production-logging | ||
} | ||
// $FlowFixMe[invalid-computed-prop] | ||
console[methodName].apply(console, newArgs); // eslint-disable-line react-internal/no-production-logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at changes in facebook-www/ReactDOM-dev.modern.js, this could call original console methods?
Or are they guaranteed to be transformed at this point? So we end up calling same warn
and error
from consoleWithStackDev
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not guaranteed to be transformed. This affects not just this but the Flight log replaying. In other words, it won't go through the warning module in www/rn. But both of these are only affecting Flight so we just need to figure that out once Flight when added to www what to do avoid Flight logs in www.
This PR itself currently leaves the transform on for RN OSS but #30320 removes that but I figured that's an independent decision. I can rebase the other PR. |
8411d18
to
9c208af
Compare
In jest tests we're already not running the forks for RN/WWW so we don't need them at all there.
9c208af
to
c83a110
Compare
Stacked on #30308. This is now a noop module so we can stop applying the transform of console.error using the Babel plugin in the mainline builds. I'm keeping the transform for RN/WWW for now although it might be nice if the transform moved into those systems as it gets synced instead of keeping it upstream. In jest tests we're already not running the forks for RN/WWW so we don't need it at all there. DiffTrain build for commit ff89ba7.
Stacked on #30308. This is now a noop module so we can stop applying the transform of console.error using the Babel plugin in the mainline builds. I'm keeping the transform for RN/WWW for now although it might be nice if the transform moved into those systems as it gets synced instead of keeping it upstream. In jest tests we're already not running the forks for RN/WWW so we don't need it at all there. DiffTrain build for [ff89ba7](ff89ba7)
Stacked on facebook#30308. This is now a noop module so we can stop applying the transform of console.error using the Babel plugin in the mainline builds. I'm keeping the transform for RN/WWW for now although it might be nice if the transform moved into those systems as it gets synced instead of keeping it upstream. In jest tests we're already not running the forks for RN/WWW so we don't need it at all there.
Stacked on #30308.
This is now a noop module so we can stop applying the transform of console.error using the Babel plugin in the mainline builds. I'm keeping the transform for RN/WWW for now although it might be nice if the transform moved into those systems as it gets synced instead of keeping it upstream.
In jest tests we're already not running the forks for RN/WWW so we don't need it at all there.