Skip to main content
Version: 11.x

pnpm-workspace.yaml

pnpm-workspace.yaml 定义了 workspace 的根目录,并允许你将目录包含在工作区中或从工作区排除。默认情况下,所有子目录的所有包都被包含。

例如:

🌐 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.

目录也在 pnpm-workspace.yaml 文件中定义。详情请参见 目录

🌐 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