Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I have a project with a workspace (around 10 packages) When I run yarn add inside one of the workspaces, it installs all node_modules even though I enabled PNP on the root package
If the current behavior is a bug, please provide the steps to reproduce.
yarn --pnp on the rootyarn add -D jest-pnp-resolver jest-resolveWhat is the expected behavior?
Step 5 should be that it installed the package, but no node_modules should be present
Please mention your node.js, yarn and operating system version.
MacOS 10.14
Node 10.13.0
Yarn 1.12.1
It also happens via yarn workspace NAME add [...deps].
seems the workspace package.json also needs
{
"installConfig": {
"pnp": true
}
}
which i assume is a bug, i assume it's supposed to inherit from the root package.json
@KwanMan I do have this on the workspace root, it was added when I ran yarn --pnp for the first time.
Should I have it on all the sub-packages as well ?
Yea I had to add it to any sub-package I wanted to run yarn add in. Then it installed as expected, no node_modules
Good to know there is a workaround, but I'd expect that it understand that it's in a pnp-enabled repo, like it can understand when it's in a workspace and install the dependencies in the parent.
I stumbled upon this bug because I was searching whether it's possible to have a monorepo with PnP enabled in some of the workspaces, but not in others. Seems that thanks to this "bug" it is? In that case for me it's a feature, though I admit it might be a confusing one.
In any case, I thought I'd mention this, because if this gets fixed, it would be nice if there's an official way to enable PnP is some workspaces only.
Most helpful comment
Good to know there is a workaround, but I'd expect that it understand that it's in a pnp-enabled repo, like it can understand when it's in a workspace and install the dependencies in the parent.