Skip to content
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

Yarn PNP: Possible alternative to yarn link for use cases where symlinks won't work #6642

Closed
empyrical opened this issue Nov 6, 2018 · 3 comments
Assignees
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. plugnplay triaged

Comments

@empyrical
Copy link

Do you want to request a feature or report a bug?
Request a feature

What is the current behavior?
At least as of Yarn 1.12.1, if I try to use yarn link [package name] in a PnP project, it will still create a symlink

If the current behavior is a bug, please provide the steps to reproduce.
I don't view it as being a "bug"

What is the expected behavior?
For cases like React Native projects (see: facebook/metro#1), symlinks are sadly not an option.

This can be awkward if you would like to yarn link a dependency that you are working on locally. For cases like this, Wix developed a tool called wml that uses Watchman to watch for changes and copy files from the dev folder to a destination folder (e.g. in node_modules). But that has its own set of issues as well. (see the section at the bottom of this article)

If there could be an option for yarn link to instead add a module in an arbitrary location to the pnp lookup file, I think this could be a good alternative to symlinks in cases like this. (I do see people perhaps wanting actual symlinks to be still supported though, so perhaps both behaviours could be supported?)

Metro does not yet have PnP resolver support (as far as I know, at least), and a lot of other parts of React Native don't yet have support for it, but when they do they could hypothetically take advantage of this.

Please mention your node.js, yarn and operating system version.
Node: 10.11.0
Yarn: 1.12.1
OS: macOS 10.13.6

@empyrical
Copy link
Author

Just tested - it actually seems like this behavior is what it does for Yarn workspaces instead of Symlinks, so that already take on one of my usecases! I guess what would need to be done is for yarn link --pnp to use PnP instead of symlinks

@arcanis
Copy link
Member

arcanis commented Nov 6, 2018

It should also do this for link: dependencies, I think! Which are a much better alternative to yarn link without having to go full workspace.

We generally don't recommend yarn link, since 1/ they make the install non-reproducible and 2/ they are poor devx in general (you need to remember to run the command, and/or to remove the links after use).

@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

Closing as fixed in v2 where PnP does not use symlinks

https://yarnpkg.com/getting-started/migration

@merceyz merceyz closed this as completed Jan 2, 2021
@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. plugnplay triaged
Projects
None yet
Development

No branches or pull requests

3 participants