-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Feature request: Warnings hook #10072
Comments
For now, the easiest workaround is to override |
@gaearon We’ve considered that approach, but it breaks devtools traceback. For example, given a file // log.js
console.error('Warning 1')
console.error('Warning 2') When run, devtools will show the source location where By overriding // override.js
console.error = (original => function () {
return original.apply(this, arguments)
})(console.error) Now all |
Good observation. |
Going to close as a duplicate of #4302. |
Do you want to request a feature or report a bug?
I want to request a feature.
What is the current behavior?
Warning code is hardcoded to call
fbjs/lib/warning
. This makes it hard to integrate warnings with tools.As a workaround we could use webpack’s
resolve.alias
to aliasfbjs/lib/warning
into our fork which displays it on-screen.Another use case is to integrate React warnings with our testing infrastructure. This helps us to better see which warning belongs to which test.
What is the expected behavior?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
The workaround works in React 15 and should still work in React 16, as the flat bundles does
var warning = require('fbjs/lib/warning')
which means we can still hook into it for now.This probably breaks when the flat bundles stopped doing
var warning = require('fbjs/lib/warning')
.The text was updated successfully, but these errors were encountered: