-
Notifications
You must be signed in to change notification settings - Fork 626
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
Support for resolving Yarn Plug 'n Play modules #308
Comments
It actually already does! We just need to open-source the resolver in a separate package (or make it native, possible) 😃 ping @rafeca |
Curious how this is going. If the internal resolver is inappropriate for open source, perhaps I could make an attempt at implementing one. I think this could probably be a first-class metro feature. Only thing I can't really figure out is a good way to unit test it. Non-PnP mode has really nice virtual filesystem for testing, and this wouldn't be able to make use of that without heavy modification (probably) |
I found it implemented here: 60bad94 |
@arcanis @empyrical was Pnp support removed? Im guessing that is why this is still open? |
Yep, I think FB removed it about a year ago since they don't use it internally. You should be able to add it back by overriding |
Now that yarn uses pnp by default, can we consider adding it again? |
@arlyon I just added an example repo with pnp and react native working. Checkout the metro.config.js here: https://github.com/dalinarkholin/react-native-pnp-enabled Also my comment here: react-native-community/cli#27 (comment) But yes, it would be good to get it back as a option as well :) |
Would it help if I provide a pull request to get this back in? If there is no interest in adding this back in we could create a separate package for it so that at least React Native has a way forward for adopting Yarn 2. |
I'd love to see this either way, but would use a separate package if metro isn't interested in adding it. |
Since it's 3 years and counting with no movement on this I'm guessing it's never going to happen. The expo crew seems to worked around it. See here: https://github.com/expo/expo/tree/master/packages/expo-yarn-workspaces I was able to use expo-yarn-workspaces to get my vanilla RN app to work in a yarn workspace |
@evelant Yarn PNP or no? |
edit: actually, no. I guess yarn had implicitly decided to use node_modules event though it wasn't configured to do so. PnP does not work, but you can use a yarn mono repo with hoisting to a root node_modules via a few autogenerated symlinks with that expo-yarn-workspaces package |
Any update? Yarn 2 has been stable and widely used for years. It would be nice if the React Native ecosystem could get on-board. |
Do you want to request a feature or report a bug?
Request a feature
What is the current behavior?
Metro does not (yet) have PnP support
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can
yarn install
andyarn test
.What is the expected behavior?
I think it would be very handy if Metro had support for resolving Yarn PnP modules.
Not only would there be the benefits you'd get for using it in other project, I believe that if this Yarn feature request is able to be resolved, this could be a reasonable alternative to using symlinks (since they are not able to be supported for technical reasons)
The text was updated successfully, but these errors were encountered: