[Bug?]: Installing a hybrid mono-repo with node-modules nmLinker package inside a pnp nmLinker root causes package to install itself in circular dependency loop #4232
Labels
bug
Something isn't working
Describe the bug
I'm trying to install a node-modules linker package inside a root mono repo with pnp. I need the node-modules linker package to use node-modules and for it to also recognize all the other packages and be able to import them.
I have a yarnrc.yml in the root with:
nmLinker: pnp
and
pnpIgnorePattern set to the package using node-modules
I have a package in the monorepo with a installConfig with hoistingLimits: workspaces
It seems to install all the pnp packages in the root when I run yarn in the root. When I run yarn in the node-modules linked package it installs all the dependencies and also installs all the shared sibling packages in the node-modules linked package which is great. However, it also installs itself... again and again in a dependency loop.
I've made a simple reproduction repo.
To reproduce just run yarn install in the root and then run it again from within the "nm" package.
Ultimately, I am trying to get our node_modules based react native project working in our pnp based monorepo. Following the instructions from the hybrid pnp+node_modules tutorial makes the react native project unable to detect the sibling packages that it depends on (we had it all working great in yarn 1 using no hoist - just no pnp). My current technique above seems to work great except for the circular dependency issue.
See the following repo for a minimal reproduction:
https://github.com/inlightmedia/yarn-monorepo-pnp-nm-loop
To reproduce
clone the git hub repo: https://github.com/inlightmedia/yarn-monorepo-pnp-nm-loop
yarn install in root
cd into the nm package
yarn install in the nm package
Note how the node_modules folder it produces has a circular dependency loop where the nm package is installed in itself.
On larger projects, eventually it crashes and the install never completes. This is more noticeable on larger projects.
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: