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
Use NodePath#hub
as part of the paths cache key
#15725
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54782/ |
I'm very confused by the "old Babel" e2e failure. That test is using EDIT: The unit test was actually using both old and new at the same time, and there are some problems with mixing traverse versions. Fixed by #14794. |
e71e957
to
af1a93e
Compare
NodePath#hub
as part of the cache keyNodePath#hub
as part of the paths cache key
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.
Would it be better for us to use ||
instead of ??
in this PR?
Posting this here to save some headaches to others If anyone gets the error Cannot read properties of undefined (reading 'addHelper')
at Scope.toArray (@babel/traverse/lib/scope/index.js:464:36)
at getSpreadLiteral (@babel/plugin-transform-spread/lib/index.js:21:20) When building after upgrading babel from 7.22.6 to 7.22.7 Make sure to switch from |
This reverts commit abb5a7c.
This fixes #6437, implementing option 2. I solved the problem of "we call
traverse
with no hub" by adding support for traversing a node visiting also the top-level node itself, so that we can directly traverse theProgram
NodePath that already has the hub.We might want to, at some point, expose that top-level traversal as an official API, such as
NodePath#traverseSelf
, but I'm intentionally keeping it under the radar now (even if technically the new capability is accessible from the third-party code).I don't know if this fixes or not #12570, because it looks like that issue has already been fixed on
main
?cc @robhogan this fixes the underlying issue of facebook/metro#906