网页 综合 更新时间 2026-11-14 16:25:22

Catalogs | Yarn

自动蜘蛛 yarnpkg.com 正文约 921 字
Catalogs | Yarn
Catalogs provide centralized dependency version management for workspaces. Inspired by pnpm's catalog functionality, they allow you to define version ranges in your .yarnrc.yml and reference them across multiple package.json files using the catalog: protocol.
This eliminates version duplication, ensures consistency across packages, and makes dependency upgrades much simpler — update one place instead of many files.
The catalog plugin is included by default starting from Yarn 4.10.0.
Define a catalog in your .yarnrc.yml:
Reference entries in your package.json:
You can define multiple named catalogs using the catalogs field for different purposes:
Reference named catalogs by specifying the name:
When publishing packages, the catalog: protocol is automatically replaced with actual version ranges, ensuring compatibility with other package managers:
The catalog: protocol works in dependencies and devDependencies.
访问原文 返回搜索 https://yarnpkg.com/features/catalogs
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。