I have a monorepo with the following file structure:
package.json
node_modules
yarn.lock
modules
- moduleA
- package.json
- node_modules
- moduleB
- package.json
- node_modules
In my top-level package.json I have:
"workspaces": ["modules/*"]
moduleB has no dependencies, at least not yet. When I ran yarn install in the root directory:
- Almost all of moduleA's dependencies were installed in the root-level
node_modules - VSCode is unable to resolve these dependencies inside of moduleA's source code
- When I
cdinto moduleA and run a script, I getMODULE_NOT_FOUNDerrors for the hoisted dependencies.
Is there a way I can configure my project so that I can access hoisted dependencies from inside moduleA? I was unable to find anything about this in the Yarn dependencies. I have used nohoist as a workaround, but this is not optimal - I want to run my modules inside of their own directories and still be able to access shared dependencies.
Yarn version: 1.22.4