Description
In a monorepo setup using yarn workspaces (possibly others, haven't checked), the name of each package in the monorepo is determined by the name field in that package.json. This can be the same as the name of the folder it resides in, but they are allowed by yarn to be different.
Take a repo set up like this
package.json (with "workspaces": ["packages/*"])
packages
| foo
| | package.json (with "name": "@my-org/foo-lib")
| bar
| | package.json (with "name": "@my-org/bar-lib")
foo
lists @my-org/bar-lib
in its package.json dependencies (and can import from that package using that name just fine)
When you try to yalc publish
in packages/foo
, you'll get a warning Could not resolve workspace package location for @my-org/shared-lib
.
It looks like it attempts to resolve workspace dependencies by assuming their directory names match their package names
Line 65 in 3b834e4
Instead, it probably needs to traverse every package in the root package.json's workspaces
and collect a map of their names to their directory paths.