Skip to content

Instantly share code, notes, and snippets.

@leventebalogh
Last active August 27, 2020 10:41
Show Gist options
  • Save leventebalogh/b145f88d33e1662cfb601e798ac1d246 to your computer and use it in GitHub Desktop.
Save leventebalogh/b145f88d33e1662cfb601e798ac1d246 to your computer and use it in GitHub Desktop.
How to use "nohoist" in Yarn workspaces for multiple packages
{
"name": "your-project",
"version": "0.0.1",
"private": true,
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/pkgA/**"
]
},
}
@leventebalogh
Copy link
Author

leventebalogh commented Aug 27, 2020

The goal:
To stop hoisting any dependency under pkgA to the root level.

Directory structure:

     /packages/
         /pkgA/
         /pkgB/

Patterns:

Pattern Description
"**" Works, stops hoisting dependencies for all packages.
"pkgA/**" Works, stops hoisting dependencies for pkgA.
"**/pkgA/**" Works, stops hoisting dependencies for pkgA.
"pkgA" Doesn't work.
"**/plugins/pkgA" Doesn't work.
"**/plugins/pkgA/**" Doesn't work.

More info:
https://classic.yarnpkg.com/blog/2018/02/15/nohoist/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment