yarnpkgyarnpkg-v3

Prevent resolving cyclic dependency to local workspace


I have a package, which offers basic utilities. It has a dev-dependency on a tool, which helps build it. That tool in turn needs features from the package.

The problem is, that during development of the package, the dependency of itself gets resolved to the local workspace, not fetching it from a registry - which obviously won't work, for two reasons:

Personally, i don't know why this behavior is desirable in the first place, but how do i disable it, forcing a resolution to the registry, fetching the current latest published version?


Using yarn 3.2.0 with pnp (could not see any related changes towards 3.2.1, therefore imho irrelevant)


Solution

  • The behavior can be disabled via enableTransparentWorkspaces: false in yarnrc.yml.


    After additional research, i found yarn-2-berry-npm-protocol-switches-to-workspace-resolution, which links to a related github Q&A, where the answer is given. Sadly, it never got accepted on github, nor propagated to the related SO question, so i'll keep this one here.