vueuse: peerDependencies on vue missing for @vueuse/core and @vueuse/shared
Describe the bug
When requesting @vueuse/core with Yarn, it complains about a missing dependency on vue due to using vue-demi:
➤ YN0002: │ @vueuse/core@npm:9.12.0 doesn't provide vue (p0865e), requested by vue-demi
➤ YN0002: │ @vueuse/shared@npm:9.12.0 doesn't provide vue (p9bab8), requested by vue-demi
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
This is due to the removal of the vue peerDependency and peerDependenciesMeta in this commit: https://github.com/vueuse/vueuse/commit/1b258ac8dbf02eb455af07b1bc52e447484f6f90
Reproduction
https://github.com/wopian/vueuse-repro (run yarn after cloning this repo to see above message)
System Info
Binaries:
Node: 19.6.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.4.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.17.0 - C:\Program Files\nodejs\npm.CMD
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 17 (2 by maintainers)
According to vue-demi’s README, plugins/libraries using vue-demi need to also provide the
peerDependenciesfor the versions ofvueand@vue/composition-apithey want to support:https://github.com/vueuse/vue-demi#usage
That would be the recommended fix for this issue.
Otherwise, for now, users of
vueusecan providepackageExtensionsin the.yarnrc.ymlto address the warning coming from yarn, with something such as the following (which mimics the required fix anyway):Parent packages need to declare the non-optional peer dependencies of packages in their dependencies as peer or optional peer dependencies. It would be optional peer dependencies with
*/any version for@vueuse/*as they do not importvuehttps://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency
I.e for each
@vueuse/*package that depends onvue-demi, they need these lines (excluding the composition package as its optional invue-demi): https://github.com/vueuse/vueuse/commit/1b258ac8dbf02eb455af07b1bc52e447484f6f90#diff-0b810c38f3c138a3d5e44854edefd5eb966617ca84e62f06511f60acc40546c7L41-L48I’m using
@vueuse/coreand I had to fix the missing peerDependencies in multiple @vueuse packages because@vueuse/coredepends on@vueuse/sharedwhich also has a dependency tovue-demi.Here are my changes to
.yarnrc.yamlto whom it may concern:Not stale