-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
unmet peer dependency warnings using yarn #1190
Comments
Are these safe to ignore or signs of a problem with the cli? |
yes, safe to ignore Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂 |
@posva it may not be a bug, but it's definitely an issue since it's preferable not to get in the habit of ignoring warnings. Do have any idea what's causing the pointless warnings so we can hopefully eliminate them? |
I don't think this issue should be closed, ignoring warning is not an acceptable solution |
Just to be clear: it's absolutely not okay to ignore warnings in general the thing is the peer dependency system is flawed in this scenario because we already provide those dependencies as direct dependencies of other packages (like webpack for vue-cli-service). I haven't tried but maybe we could list those internal packages as peerDependencies and it will remove the warning. For example, adding |
If I understand correctly this might remove the warnings related to vue-cli packages, however there are still other packages that obviously can't add vue-cli as a peerDep, like for example ts-jest or sass-loader metioned in the comment above |
Not having |
Please don't rely on this. A package is only allowed to access what it explicitly lists in its dependencies - anything else is susceptible to break in various and non-predictable ways, depending on the other projects used by your users or the version of their package manager. Note that you are perfectly allowed to list |
Also note (I don't think it's the problem here, but it's still relevant) that Yarn supports optional dependencies 🙂 |
If we add webpack as a direct dependency of your project, then you lose the advantage of having this dependency managed by vue-cli-service. And since by default, you only use webpack through vue-cli-service, it's totally fine to have it only as a dependency of cli-service only in this regard. Similarly, other core plugins, like the babel plugin, have dependencies like babel-loader, which has a peerDependency for webpack, which is satisfied by But yes, we could add webpack as a dependency to |
We (Yarn, but also pnpm) very strongly recommend listing peer dependencies at every step of the dependency chain - meaning that if A depends on B and B has a peer dependency on C, then A must also have a peer dependency on C.
Yarn v2 will introduce a new feature (constraints) that will make this use case a much better experience for workspace maintainers. Wanna be early adopters? 🙂 |
@arcanis Sounds cool! But 2.0 is still a long way to go right? I'll need to open a new issue as an enhancement request to get this sorted out throughout the monorepo meanwhile |
Version
3.0.0-beta.9
Reproduction link
https://github.com/rgant/vue-helloworld-test-fails
Steps to reproduce
Run
yarn add something
. Also for remove.What is expected?
No warnings
What is actually happening?
unmet peer dependency warnings.
The text was updated successfully, but these errors were encountered: