Search code examples
node.jsyarnpkg

yarn add dependency to worskpace from another workspace


Say, I have a root package with two workspaces, app and calc. In npm I use npm install -w app calc which makes the app package to depend on the calc package. What is yarn equivalent of this command? I run yarn workspace app add calc -W and it adds the dependency to the global package.


Solution

  • The command is yarn workspace app add calc --peer. This will add calc package as a peer dependency to the app workspace.