package.json 'dependencies' 值中的 `workspace:` 前缀是什么意思?

What does a `workspace:` prefix in a package.json 'dependencies' value mean?

我在哪里可以详细了解什么是版本号中的 workspace: 前缀?

例如,在 Babel 中:

  "dependencies": {
    "@babel/helper-plugin-utils": "workspace:^7.13.0",

source

这是yarn2.x的一个特点。您可以在 yarn 文档中阅读更多相关信息,网址为 https://yarnpkg.com/features/workspaces#workspace-ranges-workspace 作为片段:

For those use cases, Yarn now supports a new resolution protocol starting from the v2: workspace:. When this protocol is used Yarn will refuse to resolve to anything else than a local workspace. This range protocol has two flavors:

  • If a semver range, it will select the workspace matching the specified version.
  • If a project-relative path, it will select the workspace that match this path (experimental).

您可以使用此命令检查此依赖关系

yarn why <dependency-name>