Skip to content
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

Add information about dependenciesMeta.*.injected #323

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ pnpm cannot guarantee that scripts will be run in topological order if there are

If you see the message `There are cyclic workspace dependencies`, please inspect workspace dependencies declared in `dependencies`, `optionalDependencies` and `devDependencies`.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a title to this section. Maybe "## Peer dependencies in a workspace"

The default peer dependency resolution can in some cases cause duplicates of peer dependencies between workspace packages. This may lead to unexpected behavior e.g. where local caches within a module are not shared by a package and its library.

One such case is transitive peer dependencies that are fulfilled differently (e.g. one installs an optional dependency while the other does not) in two workspace packages.

To avoid having package `a`:s dev dependencies available to `a` when used as a dependency in `b`, set `"dependencyMeta": { "a": { "injected": true } }` in the `package.json` file for package `b`. See [dependenciesMeta.*.injected]

[dependenciesMeta.*.injected]: package_json.md#dependenciesmetainjected

## Usage examples

Here are a few of the most popular open source projects that use the workspace feature of pnpm:
Expand Down