Config Dependencies
Config dependencies allow you to share and centralize configuration files, settings, and hooks across multiple projects. They are installed before all regular dependencies ("dependencies", "devDependencies", "optionalDependencies"), making them ideal for setting up custom hooks, patches, and catalog entries.
Config dependencies help you keep all the hooks, settings, patches, overrides, catalogs, rules in a single place and use them across multiple repositories.
If your config dependency is named following the pnpm-plugin-*
pattern, pnpm will automatically load the pnpmfile.cjs
from its root.
How to Add a Config Dependency
Config dependencies are defined in your pnpm-workspace.yaml
and must be installed using an exact version and an integrity checksum.
示例:
pnpm-workspace.yaml
configDependencies:
my-configs: "1.0.0+sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="
Important:
- Config dependencies cannot have their own dependencies.
- Config dependencies cannot define lifecycle scripts (like
preinstall
,postinstall
, etc.).