Skip to content

issue: Peer dependencies not picked up by package managers #762

Open
@arlyon

Description

@arlyon

Version Number

5.0.1

Codesandbox/Expo snack

https://codesandbox.io/p/devbox/hkjpmt

Steps to reproduce

  • open codesandbox vm
  • cd apps/site
  • pnpm ls --depth 2 --prod

Observe

@hookform/resolvers 5.0.1
├── @standard-schema/utils 0.3.0
└─┬ react-hook-form 7.55.0 peer
  └── react 19.0.0 peer

Expected behaviour

For the resolvers to build reliably, the package manager needs to know what the peer deps are so that they may link them properly. Without this information, you can end up with unpredictable build errors where, by pure coincidence, a package (which is not listed in the dependencies such as effect) is not available. I am running into this error but cannot replicate it on codesandbox since the preconditions are dependent on a complicated combination of the layout of your workspace, hoisting, package manager, and indeed the build tool you are using (in my case it is nextjs + turbopack).

Listing peer dependencies only in the package.json files in the sub-folder (effect in this case) does not supply enough information to the package manager to be able to hoist / link reliably. They need to be at the top level.

The only solution is to break this into individually-adressable packages (@hookform/resolver-effect for example) or to list all the peer deps in the top level package.

What browsers are you seeing the problem on?

No response

Relevant log output

➜  site git:(main) ✗ pnpm ls --depth=2 --prod
Legend: production dependency, optional only, dev only

react-vite-ts@0.0.0 /project/workspace/apps/site (PRIVATE)

dependencies:
@hookform/resolvers 5.0.1
├── @standard-schema/utils 0.3.0
└─┬ react-hook-form 7.55.0 peer
  └── react 19.0.0 peer
effect 3.14.6
├── @standard-schema/spec 1.0.0
└─┬ fast-check 3.23.2
  └── pure-rand 6.1.0
effect-example link:../../packages/effect
└─┬ effect 3.14.6
  ├── @standard-schema/spec 1.0.0
  └── fast-check 3.23.2
react 19.0.0
react-dom 19.0.0
├── react 19.0.0 peer
└── scheduler 0.25.0
react-hook-form 7.55.0
└── react 19.0.0 peer

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions