-
-
Notifications
You must be signed in to change notification settings - Fork 26.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
Yarn PnP is not compatible with optional peer dependencies #5380
Comments
/cc @arcanis x-ref: yarnpkg/yarn#6487 |
I think there's two different problems, and I'm not sure they're PnP per se.
Ironically, If I read the thread correctly, the main reason for removing it was to make the peer dependency warning go away, which is something that should be fixed at the package manager level, like what we're doing in yarnpkg/yarn#6487. |
The test output isn't specifically what I was worried about, it more-so just brought it to light. But yes, this is more about supporting optional peer-dependencies (yarnpkg/yarn#6487). |
sass-loader also supports dart-sass as a replacement implementation of node-sass (you'll need to pass it in as a option per https://github.com/webpack-contrib/sass-loader#examples ), so the user gets to decide which one to use. |
@Timer 😢 Not an option because of the warning, right? Is there something else, or would fixing this in Yarn be good enough for you? @bugzpodder It also depends on how you'll want the cra users to specify that they want to use dart-sass, but overall it shouldn't be an issue with PnP, since it's the configuration file that will make the |
So it sounds like the initial problem is fixable by just making use of the |
Yeah, the warnings are a constant source of issues for us to deal with. Especially when people start trying to resolve them themselves and start installing random dependencies left and right. We see it quite frequently. Just Yarn support probably won't be good enough. We'll want a story for npm too. Also, something to keep in mind:
|
tldr Yes. Otherwise it could cause issues. In more details, let's say we have the following situation:
In this situation, we need to make Problem is, doing this doesn't solve our issue - we still have a Since virtualizing a package means that it will be instantiated as many times as it has a unique parent in the dependency tree, and since the PnP standard guarantees that this only happen on packages with peer dependencies (so that the behavior is 100% predictable), B is required to explicitly list a peer dependency. |
OK -- awesome. We definitely need to figure out the npm side of this story, then. |
Can you try the latest release and see if this has improved? If not please open a new issue. |
This makes PnP incompatible with how we're shipping Sass and planning to ship future enhancements (e.g. TypeScript).
Optional peer dependencies are vital to keeping initial install sizes low (less of a problem with PnP, but imagine a cache miss).
See broken test:
The text was updated successfully, but these errors were encountered: