-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,7 +227,8 @@ For example: | |
|
||
This field allows you to instruct pnpm to override any dependency in the | ||
dependency graph. This is useful to enforce all your packages to use a single | ||
version of a dependency, backport a fix, or replace a dependency with a fork. | ||
version of a dependency, backport a fix, replace a dependency with a fork, or | ||
removing an unused dependency. | ||
|
||
Note that the overrides field can only be set at the root of the project. | ||
|
||
|
@@ -246,7 +247,7 @@ An example of the `"pnpm"."overrides"` field: | |
} | ||
``` | ||
|
||
You may specify the package the overriden dependency belongs to by | ||
You may specify the package the overridden dependency belongs to by | ||
separating the package selector from the dependency selector with a ">", for | ||
example `qar@1>zoo` will only override the `zoo` dependency of `qar@1`, not for | ||
any other dependencies. | ||
|
@@ -282,6 +283,20 @@ The referenced package does not need to match the overridden one: | |
} | ||
``` | ||
|
||
If you find that your use of a certain package doesn't require one of its dependency, | ||
you may use `-` to remove them. For example, package `[email protected]` requires a big package | ||
named `bar` for a function that you don't use, removing it could reduce install time: | ||
|
||
```json | ||
{ | ||
"pnpm": { | ||
"overrides": { | ||
"[email protected]>bar": "-" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## pnpm.packageExtensions | ||
|
||
The `packageExtensions` fields offer a way to extend the existing package definitions with additional information. For example, if `react-redux` should have `react-dom` in its `peerDependencies` but it has not, it is possible to patch `react-redux` using `packageExtensions`: | ||
|
@@ -685,4 +700,3 @@ Functionally identical to [`pnpm.overrides`], this field is intended to make it | |
|
||
[pnpm patch-commit]: ./cli/patch-commit.md | ||
[`pnpm.overrides`]: #pnpmoverrides | ||
|