nohoist with workspaces still hoisting
I tried a few options but the only one that finally worked for me was specifying the nohoist
option in the child package. No need to specify anything at the root level.
So my package.json
in B
package is:
{
...
"workspaces": {
"nohoist": ["**"]
},
...
}
In my experience, it has been necessary to doubly specify each package in the following manner:
{
"nohoist": [
"**/B",
"**/B/**",
"**/C",
"**/C/**"
]
}
In addition, I have found it necessary to delete all existing node_modules
folders after modifying the nohoist
settings. So, if your projects are in packages
, and you are in your project directory, you can delete all of those node_modules
folders like this:
# delete node_modules on linux
rm -rf ./packages/*/node_modules
rm -rf ./node_modules
# install again
yarn install --check-files
Applying the nohoist to the child package's package.json did it for me.
"workspaces": {
"nohoist": [
"*react-native*",
"*react-native*/**"
]
},