How to use “nohoist” in Yarn workspaces?
Sometimes you are in a state where you don’t want your underlying package dependencies to be hoisted to the root level.
Unfortunately from the Yarn docs it’s not super straightforward how to configure this setting in case you have multiple packages under a subdirectory:
/packages/
/pkgA/
/pkgB/
Let’s say our goal is to stop hoisting any dependencies living under pkgA
to the root level.
Working patterns for this scenario:
- "**"
- "pkgA/**"
- "**/pkgA/**"
NOT working patterns for this sceanrio:
- "pkgA"
- "**/plugins/pkgA"
- "**/plugins/pkgA/**"
A working package.json
file snippet:
More info: https://classic.yarnpkg.com/blog/2018/02/15/nohoist/