I love yarn workspaces, but more often than not I find myself having to pull out a specific package because of incompatibilities with external tools.
The main issue is that I don't have their source code in the relative node_modules, but a few levels above (which is normal for yarn workspaces and node, in general).
For instance, ZeppelinOS gives the following error message when "openzeppelin-eth" is not found in the relative path:
Could not find a zos.json file for 'openzeppelin-eth'. Make sure it is provided by the npm package.
Is there a way to force-copy a package? I read about --focus, but it's not what I need.
What you're looking for is called nohoist
https://yarnpkg.com/blog/2018/02/15/nohoist/
Basically you have two options:
"workspaces": {
"nohoist": ["react-native", "react-native/**"]
}
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/react-native", "**/react-native/**"]
}
If you want to share package xyz
among all your sub-projects, then set it in the root, otherwise in the child project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With