-
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
React depends on an older version of core-js, breaking the usage with the new babel #13018
Comments
React doesn't really "depend" on core-js in practice for anything. It's true that it's in a dependency tree (which is kinda unfortunate) but we don't end up using any of its modules. So React can't possibly break your app with this. If you're seeing some kind of conflict it probably means your package manager has a bug, and incorrectly hoists a package version. |
So it's a yarn issue? I don't really know how hoisting works, but I will provide a basic reproducible repo and submit the issue there |
I can't tell for sure—your screenshot doesn't show who's attempting to import that module |
That's the package.json, the root of the project. I tested it in isolation both with yarn and npm, and the behaviour is different. Npm installs correctly the updated dependency, whereas yarn gives precedence to the 1.x one. Will make a repo and submit the issue at yarn, hopefully they will look into it. |
I don't understand what you're saying. I'm asking which package is attempting to load |
Sorry, it's Async iterators are present only in core-js v2.x.x. |
So you're saying |
Yup, only using yarn. After doing EDIT: maybe I'm doing something wrong, let me create the repo |
The version in the top level folder is not necessarily what matters. What matters is that following Node resolution algorithm ( Tools like npm or yarn can choose to put a package to Looking at your reproducing example, the version I get from |
Thanks for your time investigating this @gaearon! Yup, you're right, not an issue with yarn. It turns out, the require is outside of var b = new Map(); into this import "core-js/modules/es6.map";
var b = new Map(); so the Babel then tells you to add |
That makes sense 👍 |
For now I solved It by adding |
You probably want it as a peer dependency instead. |
Or, rather, you want |
@marcofugaro How did your print the dependency tree so nicely? :) |
|
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
React is relying on an older version of core-js which goes in conflict with the newer beta version of babel.
The older version gets installed instead of the newer, so it results in errors like
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React v16.4.0
The text was updated successfully, but these errors were encountered: