-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature] install peer dependencies for packages #3710
Comments
With that being said, Yarn supports "peer dependencies with defaults": if you list a dependency as both a peer and regular dependency, Yarn will use the parent-provided dependency, but will fallback to the regular one if missing. Pnpm supports it too, and I believe even npm supports that somewhat accidentally due to how their "auto-installs" work. |
Also note that for the "keep the ranges in sync between peer and dev", "enforce that peers have a dev counterpart", etc use cases, the recommended solution would generally be to use constraints. |
Describe the user story
Package authors/maintainers who specify
peerDependencies
often have to include the same package as adevDependency
for testing, editors seeing types and more. While this is a workaround that works, often the versions can have a mismatch (peer:3.x
while dev can be3.5
and the consumer would have3.7
).npm 7 and npm 8 support installing peer dependencies automatically.
The goal of this feature is to implement the same
Describe the solution you'd like
Automatically install dependencies listed in
peerDependencies
in package.json. This is NOT installing the peers for a package (iereact-select
).Describe the drawbacks of your solution
There can be confusion where consumers think this would install all peer dependencies of libraries listed in their package.json. This is not the case. This only solves installing the packages in
peerDependencies
for the current package.json.Describe alternatives you've considered
As described above, a workaround is to specify the
peerDependencies
anddevDependencies
.Another is this package: https://www.npmjs.com/package/install-peers. This only worked with a fresh install of
node_modules
The text was updated successfully, but these errors were encountered: