Skip to main content
Version: Next

pnpm-workspace.yaml

pnpm-workspace.yaml defines the root of the workspace and enables you to include / exclude directories from the workspace. By default, all packages of all subdirectories are included.

For example:

pnpm-workspace.yaml
packages:
# specify a package in a direct subdir of the root
- 'my-app'
# all packages in direct subdirs of packages/
- 'packages/*'
# all packages in subdirs of components/
- 'components/**'
# exclude packages that are inside test directories
- '!**/test/**'

The root package is always included, even when custom location wildcards are used.

Catalogs are also defined in the pnpm-workspace.yaml file. See Catalogs for details.

pnpm-workspace.yaml
packages:
- 'packages/*'

catalog:
chalk: ^4.1.2

catalogs:
react16:
react: ^16.7.0
react-dom: ^16.7.0
react17:
react: ^17.10.0
react-dom: ^17.10.0

packageConfigs

Added in: v11.0.0

Allows setting project-specific configuration for individual workspace packages. This replaces workspace project-specific .npmrc files.

packageConfigs can be specified as a map of package names to config objects:

pnpm-workspace.yaml
packages:
- "packages/project-1"
- "packages/project-2"
packageConfigs:
"project-1":
saveExact: true
"project-2":
savePrefix: "~"

Or as an array of pattern-matched rules:

pnpm-workspace.yaml
packages:
- "packages/project-1"
- "packages/project-2"
packageConfigs:
- match: ["project-1", "project-2"]
modulesDir: "node_modules"
saveExact: true