Yarn workspaces shared dependencies
Asked Answered
S

0

5

I'm trying to build a project that uses yarn workspaces.
And here's what I want to accomplish in my setup:

> root
  > packages
    > client
        package.json
          - graphql
    > server
        package.json
          - graphql
  package.json
    - graphql

I installed graphql in my root package.json because graphql-codegen needs it to be there (otherwise it will give me wall of unmet dependency warnings!).

AFAIK, if I want to install the same exact dependency in more than 1 workspace, I need to specify it inside peerDependency, so I did. I tried to peer install graphql inside server package.json, but then yarn gave me this warning below and install graphql in dependencies instead.

"graphql" is already in "dependencies". Please remove existing entry first before adding it to "peerDependencies".

Am I missing something?

Skilken answered 17/2, 2021 at 13:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.