-
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
Remove runtime dependency on prop-types #18127
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d241149:
|
Details of bundled changes.Comparing: 739f20b...d241149 react
react-dom
react-native-renderer
react-art
react-test-renderer
react-reconciler
ReactDOM: size: 0.0%, gzip: 0.0% React: size: 0.0%, gzip: 0.0% Size changes (stable) |
Details of bundled changes.Comparing: 739f20b...d241149 react
react-art
react-dom
react-test-renderer
react-native-renderer
react-reconciler
ReactDOM: size: 0.0%, gzip: 🔺+0.1% React: size: 0.0%, gzip: 0.0% Size changes (experimental) |
Looks like the tests doesn’t “see” the stack. |
Yeah, only for shallow renderer. I think it just needs to play along nicely by setting the current stack function. |
k this should fix it |
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.
It would be nice if react-shallow-renderer did this too.
Why? |
@gaearon wouldn't it make more sense to add native ESM to prop-types? I'm happy to do that. |
I think that would be good in general but the concern is that the ecosystem is not ready for transitive usage of ESM. We don’t want to make them autodiscoverable yet, but then it’s hard to try them without manually aliasing everything. So we were hoping to make this very scoped. Since we don’t really need either of those deps in a meaningful way. We also wanted to make React itself have zero dependencies anyway. |
Node 13.3+ supports it and it’s planned to be backported into node 12 in April, I’m not sure why the ecosystem wouldn’t be ready. “zero dependencies” isn’t honestly reached by inlining dependencies :-/ I’m confused why that’s a valuable. |
Zero dependencies is a valuable property for predictability, security, risk of downstream breakages and being able to reason eg about cost. Also makes things easier for our maintainability. It comes with tradeoffs too but if this is the only one left, it doesn’t provide much value to leave it in. Especially since it’s DEV only it doesn’t get duplicated in prod so it doesn’t come with the normal downside of code duplication in the production bundles. Another nice property is that now |
FYI it's been reported that this change broke behavior of |
This is to unblock the ESM work. There is no good story for using a CJS dependency so let's just inline this back. I lost the last argument because
console.error
now "sees" the stack again.