Reputation: 1253
I'm trying to switch to yarn workspaces, in V2 but keep getting an Invalid dependency range
error for the new workspaces:
syntax when used with peerDependencies
I've tried using an exact range, workspaces:*
and carat syntax workspaces:^
with no luck.
Is this just not supported with Yarn Workspaces? Is the problem that I'm using an alpha package with a peerDependency?
If I take out the peer dependency and only leave in the devDependency in the same package (for importing the package in testing) the same package resolves successfully
workspace package.json:
{
"name": "spaceA",
"version": "1.0.0-alpha.4",
"peerDependencies": {
"spaceB": "workspace:*", # << Fails No Matter What
},
"devDependencies": {
"spaceB": "workspace:1.0.0-alpha.3" # << Works with all syntaxes
}
}
Upvotes: 1
Views: 943
Reputation: 1253
The current stable release of Yarn does not support peerDependencies with the workspaces:
protocol
However as of 2021-09-28:
Setting a static version to the current "unreleased" version updates properly when bumping versions on the other package with yarn workspace spaceB version minor
without the workspaces protocol if you are willing to chance a network install (zero if not yet released)
The current master branch and canary release both support peer dependencies
yarn set version from sources
Or
yarn set version canary
When these versions have been released to stable this issue should be resolved
Upvotes: 2