Doesn't work with yarn workspaces by default
See original GitHub issueI have a monorepo which is essentially a repository with many npm packages in it and I just started using yarn workspaces which hoists all dependencies to the root of the repository. I realized that all my node_modules were getting included because they were now located in a node_modules folder two parents up. So I had to switch to externals: /node_modules/
Issue Analytics
- State:
- Created 6 years ago
- Reactions:41
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Workspaces - Yarn
Workspaces are a new way to set up your package architecture that's available by default starting from Yarn 1.0. It allows you to...
Read more >Scaling out JavaScript Monorepos with Yarn Workspaces
Bear in mind that, by default, Yarn does zero install setups. That means that all downloaded modules are committed to the remote repository....
Read more >Working with monorepos - Expo Documentation
In this example, we will set up a monorepo using yarn workspaces without the nohoist option. ... Metro doesn't come with monorepo support...
Read more >yarn workspaces shared package does not load in create ...
I am using yarn workspaces to maintain my monorepo with this structure: root |- package.json |- packages | - frontend -> create-react-app ...
Read more >Advanced package manager features for npm, Yarn, and pnpm
npm workspaces; Yarn Berry workspaces; pnpm workspaces ... When using the default configuration, pnpm and Yarn Berry do not use the same ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@barraq you can accomplish the same thing without any code changes to this package by just including multiple instances:
+1
Ideally the default modulesDir behavior would be to walk the workspace to its root (consulting all node_modules directories from package to root); thus, webpack-node-externals would work out of the box for monorepos.
There are a few issues with the current solutio of hard-coding module dirs:
Also, node itself seems to resolve from node_modules up the directory tree. (I see it do so when I run node scripts that require hoisted libs.) Webpack and other libraries, similarly. So this would be idiomatic, no? If so, perhaps there’s a direct/normalized library/facility for doing this walk that could be leveraged.