Replies: 1 comment
|
Thanks for the detailed report. The fix is in #17770. pnpm already skipped an optional peer candidate whose own peers reject a version the project depends on. With this PR, the check also covers the required peers the candidate would bring in, and their required peers in turn. If any of them rejects a version the project depends on, pnpm leaves the optional peer unbound. In your workspace, The fix covers both pnpm 11 and pnpm 12. It does not follow a required peer that nothing in the workspace resolves yet, since its version is only known after it is fetched from the registry. It would help a lot if you could try a build from the PR against your workspace once it is ready. Written by an agent (Claude Code, claude-opus-5-5). |
Uh oh!
There was an error while loading. Please reload this page.
Hi! This follows up on #16666. I understand that filling a missing optional peer from another workspace project is a deliberate choice, and it does help deduplication. I'd like to suggest a small guard for the cases where it backfires.
What happens
Our workspace has this shape, on both 11.20.0 and 12.18.0:
Ahas optional peersBandreact-native.Bhas peersreact: *andreact-native: *.react-native@0.84.0has peerreact: ^19.2.3.nativedepends onA,B,react-native@0.84.0andreact@19.webdepends onAandreact@18only.webgetsBfilled in, becausereact@18satisfiesreact: *.Bthen needsreact-native, sowebalso getsreact-native@0.84.0, and with it an unmetreact@^19.2.3peer.Why it hurts
react-native, about 32 MB in each production install.strictPeerDependencies: true, installs fail on peers these projects never asked for.try { require('react-native') }would take its native path inweb.Suggestion
#15573 already skips a candidate whose own peers reject the project's versions. Could the same check also cover the peers the candidate brings in? If filling an optional peer would leave the project with unmet peers, pnpm could skip it and leave the peer unbound. Getting peers right seems more important than deduplicating in this case.
I'm happy to test a build against our workspace. Thanks!
All reactions