-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix: List optional peer dependencies #1390
Conversation
@@ -37,8 +37,18 @@ | |||
}, | |||
"peerDependencies": { | |||
"react": "^16.8.3", | |||
"react-dom": "^16.8.3", | |||
"react-native": "^0.18.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never used react-native
. Just use the note from the readme:
As of React Native 0.18, React Redux 5.x should work with React Native.
Deploy preview for react-redux-docs ready! Built with commit 4fde80f |
This has been brought up several times before. The current behavior is quirky but correct, and there's no need to change. |
Actually, this is correct, but only once npm >= 6.11 is in greater circulation. It won't show the error (the reason for this extension to the package.json format), but only for those versions. Let's leave this one open until npm >= 6.11 has been bundled with Node for a while. |
BTW, npm releases are delayed 2 weeks before being bundled into node. nodejs/node#29273 is just about ready to go and nodejs/node#29430 still has 12 days to go. But likely the next 12.x release will have it. I'm not sure what the LTS schedule is. |
I'm not sure how you define "correct" in this context but the dependency trees created from it are incorrect. All I could find about "react dom peer" in the issues is an old statement from dan (#130 (comment)) which
|
If they are marked optional with peerDependenciesMeta, they won't warn at all. |
This is incorrect. With the optional peer dependencies, peer dep warnings will only be printed if:
Anyway, I've just suggested what I think is an reasonable compromise: if you don't list peer dependencies, please at least put the |
@arcanis : my statement about wanting to avoid unnecessary warnings still stands, but no, this is the first time I've heard of "optional peer dependencies", so I'm not familiar with the distinction here in how they behave. |
I'll add the optional stuff to the package.json now. It doesn't hurt anything to add it. And if the package managers adopt it as working without the peerDeps entry, that's great. |
@markerikson Fwiw documentation is here: Note that it's already implemented in both Yarn 1 (initial rfc) and pnpm. Npm has merged my PR too, but they have to do a fix on their server to return the field on the initial installs (they use a special endpoint which removes most fields from the manifest, including the The distinction is that a package manager will simply discard the warning if the peer dependency is marked The change I've just landed makes it possible to list @timdorr Awesome, thanks! 🙏 |
Looks like this was resolved by 388d9e4 . |
react-dom
is required from the main bundle (not really optional I suppose) whilereact-native
is required when using it withreact-native
and their batched updates.Additional context:
[email protected]
,[email protected]
but not yet bundled with node andpnpm@?
I'm currently not using this feature myself until node bundles
[email protected]
. Just creating this PR now so that we can discuss any concerns you have.