All Questions
90
questions
30
votes
5
answers
25k
views
nohoist with workspaces still hoisting
Inside my Monorepo I have one packages in which I want all the dependencies inside its node_modules.
But whatever I do, it's node_modules remains empty.
So, for the purpose of my question I was ...
29
votes
1
answer
15k
views
Peer Dependencies In A Monorepo
When packages in a monorepo have peer dependencies, how should these dependencies be made available to them during development?
For example a package at /packages/namespace/alpha/ might have a ...
24
votes
2
answers
4k
views
Install package from lerna-managed monorepo via git URL
I am using yarn for my project. My project has a dependency which happened to be a subpackage of larger monorepo maintained by lerna.
The subpackage was updated but not published yet and I need that ...
23
votes
1
answer
4k
views
Yarn workspace, react, monorepo issue with conflict library version
I'm experimenting with yarn workspace monorepo. It is consisting of a TestProject created with create-react-app, and a SharedLib1 which is created with create-react-library. TestProject imports code ...
23
votes
0
answers
3k
views
With Yarn workspaces, how can compiled binaries be linked to the workspace post-compilation?
Context
Yarn workspaces provide for a convenient mono-repo-like functionality where packages are automatically linked. I.e. they can require/import each other, and their binaries are linked and ...
21
votes
4
answers
9k
views
Typescript: Yarn Workspaces IDE Support (IntelliJ, VSCode ...)
Working on a larger typescript project we decided to move the code to a monorepo with yarn workspaces.
We use webpack to build and bundle and everything works well (especially the linking between ...
15
votes
3
answers
8k
views
How to avoid install of packages in monorepo using Yarn
I built a monorepo using Lerna and Yarn workspaces.
Everything works fine but everytime I install a new dependency on a package (let's call him A) using:
yarn add <package_name>
Yarn adds it ...
15
votes
2
answers
7k
views
How to bump version in all the packages when using yarn workspaces?
When using Yarn Workspaces, we have a project structure like:
- package.json
- packages/
- package-a/
- package.json
- index.js
- package-b/
- package.json
- ...
14
votes
6
answers
20k
views
"'rootDir' is expected to contain all source files" in monorepo
I'm working on converting a large(ish) monorepo into TypeScript for a client, however, I'm pretty new to TS myself and have run into an error that I can't find an obvious fix for.
TS6059: File '[path ...
13
votes
2
answers
7k
views
Sharing config variables across projects in a monorepo using yarn workspaces?
Is it possible to share config variables / env variables across subfolders of a monorepo that is set up using yarn workspaces? We've got a monorepo for a project, and several of the subfolders are ...
12
votes
1
answer
15k
views
migrating to yarn 3 + workspaces + nohoist
I'm migrating from yarn 1.xx to yarn 3 and I'm currently having a workspaces definition with nohoist configuration in my package.json:
"workspaces": {
"packages": [
&...
11
votes
1
answer
9k
views
monorepo Yarn workspaces - shared esLint and Prettier configs
How someone could share esLint/prettier config across Yarn workspaces(no NPM, Lerna and etc).
I try to keep things pretty high level but I have tried to create a separate package for esLint config and ...
11
votes
1
answer
3k
views
Enforcing shared dependencies in a monorepo
We have a monorepo using lerna and yarn workspaces. Multiple teams contribute packages to it and there are some common dependencies where we want to force people to use the same version.
What are the ...
10
votes
0
answers
702
views
Deploying yarn workspace monorepo app with internal dependencies to Google App Engine
I want to deploy my app from my monorepo to GAE. The app depends on local packages that I pre-publish to github packages. To make life easy, I just tell my app to always get latest:
"...
9
votes
2
answers
10k
views
Yarn Link All Packages/Workspaces
Yarn's link allows you to register a local package for symlinking into another local package. To use link you cd into the package directory and run yarn link. This works fine on individual packages, ...
9
votes
2
answers
12k
views
What does a `workspace:` prefix in a package.json 'dependencies' value mean?
Where can I learn more about what is workspace: prefix in version number?
For example, in Babel:
"dependencies": {
"@babel/helper-plugin-utils": "workspace:^7.13.0",...
7
votes
3
answers
7k
views
React-native, monorepo: Unable to resolve module @babel/runtime/helpers/interopRequireDefault
I've set up a react-native app as workspace in a monorepo. I did this because I want to share some react components I've created between my mobile and web apps.
The basic structure of my repo is:
...
7
votes
1
answer
5k
views
Resolving TypeScript dependencies in yarn workspaces
I'm currently trying to set up a React/TypeScript monorepo with two workspaces, @scope/project-lib and @scope/project-app. I have @scope/project-app's package.json importing @scope/project-lib: "*...
7
votes
1
answer
1k
views
Monorepos and cross package development. To use src/ or dist/?
My fellow yarn workspace typescript monorepo-nians,
Question: When you are working within a monorepo are you able to import and use source code across packages or do you rely on the build steps ...
7
votes
0
answers
2k
views
Force Hoisting Of Package Dependencies In Yarn (v1) Workspace
I have a monorepo containing many packages. It is using yarn(v1) workspaces. One of the packages contains a set of development dependencies (packages/example-dev/@example/dev) that are consumed as a ...
6
votes
1
answer
2k
views
Yarn workspace + lerna is creating node_modules in each sub-package
I have a monorepo which I'm managing with yarn workspaces + lerna. From what I understand, running yarn should create a node_modules directory at the root of the project but not in each individual ...
6
votes
1
answer
2k
views
Is lerna bootstrap command useful when using yarn workspace
I'm using lerna in combination with yarn workspaces.
In that case, all the package hoisting and symlinking is handled by yarn workspaces.
In that particular case, what's the role of the lerna bootsrap ...
6
votes
2
answers
906
views
Pointing the main field in package.json conditionally
I have a Monorepo under Lerna and Yarn Workspaces. The repo has packages which are published to npm and consumed outside the monorepo as well as within the monorepo. While developing in the monorepo ...
6
votes
1
answer
956
views
react-native cannot find node_modules that exists. this probably only occurs when I use yarn workspaces
In order to add it I ran the following command:
yarn workspace mobile add react-native-webview
I literally have looked in the node_modules folders that is specific by the error below and react-...
6
votes
0
answers
936
views
How to use local resolutions in yarn workspaces?
I have a monorepo based on yarn workspaces, with two projects, A and B. Both projects depend on the foo package.
I would like to create a resolution in the parent package.json file (since resolutions ...
6
votes
1
answer
4k
views
How to publish yarn workspace with root package.json dependencies?
I'm trying to publish one (yarn) workspace from a monorepo to npm repository, and include root project's dependencies in the published package. The setup is as follows:
package.json (contains shared ...
6
votes
0
answers
2k
views
Creating a usable library on npm... with yarn workspaces
I'm looking for feedback on a pattern I coded while tinkering around.
Context
I'm creating a package for my company, which going to be released publicly. The DX (Developer Experience) is the most ...
6
votes
0
answers
198
views
How to automate publish in a CI environment?
We are using lerna to manage a monorepo and we want to automate the publishing process:
The developer makes changes in one of the packages in the monorepo
The CI detects that changes have been made
...
6
votes
1
answer
1k
views
Is there any way to avoid symlinking in monorepo built with yarn workspaces and lerna?
Lets say there is a monorepo with package A and B.
Package A is dependent on B. Package B is also published in npm registry. So when installing dependencies it does not install the package B from npm ...
5
votes
1
answer
10k
views
yarn not installing packages from workspace but instead tries pulling down from npmjs with turborepo
Version:
"packageManager": "[email protected]"
I have based my project off of the npx create-turbo@latest command.
I have eslint-config-custom and tsconfig projects inside my /packages ...
5
votes
1
answer
2k
views
Force yarn to install certain modules to given workspace, rather than moving them to shared node_modules of monorepo?
I have a monorepo (via yarn workspaces). One of the workspaces is a React app created via Create React App (I think this is important, because CRA puts Webpack/Babel in its own node_modules). Another ...
5
votes
1
answer
1k
views
How can I deploy to Google App Engine an app that depends on a yarn workspaces without publishing the packages to a npm registry?
I am currently migrating our monorepo to yarn workspaces. It contains multiple packages and services. Services depends on packages in their respective package.json. I would like to deploy my services ...
5
votes
1
answer
2k
views
How do I use the tsconfig.json "types" field when in a monorepo?
Part 1 - An example of using the "types" field
TypeScript library A provides type definitions in addition to its "normal" exports, like this:
declare global {
function ...
5
votes
1
answer
2k
views
yarn: install local package from monorepo and use it inside docker image with offline cache
My folder structure looks like this (monorepo):
project
|
+--- /api
| |
| +--- /.offline-cache
| +--- /src
| | +--- index.js
| | +--- ...
| |
| +--- Dockerfile
| +--- ...
5
votes
1
answer
1k
views
How to manage multiple monorepos
In our projects we have multiple monorepos used across whole company. The problem is, that we have for example monorepo-A and monorepo-B and monorepo-B uses components from monorepo-A (this is ...
5
votes
0
answers
531
views
Monorepo Yarn workspaces with Typescript in VSCode
I create several repositories using Yarn Workspaces. Web works fine just my VSCode and Typescript (maybe eslint - but I do not use it in this project) are not happy with my monorepo. When I make ...
4
votes
1
answer
2k
views
Typescript builds files with incorrect path in monorepo
I have an example monorepo with 3 packages: back, front and shared. With the following folder structure:
root
├── back
│ ├── dist
│ ├── src
│ ├── test.ts
│ ├── package.json
│ └── ...
4
votes
2
answers
2k
views
How can I use my own monorepos as package.json dependencies directly from github?
I am heavily using github directly (i.e. not using the npm registry) for my own reusable node modules. So what I do in my package.json (I use yarn classic) is this:
"dependencies": {
&...
4
votes
0
answers
308
views
What is the right way of building and running repos using Yarn Workspaces?
I've been working on a project using monorepo and leveraging yarn workspaces.
It consists of several apps and common, e.g.
"server" (TS/Node app),
"web" (React app with Material ...
4
votes
2
answers
957
views
How can I run two dev servers with yarn workspaces?
I have two yarn workspaces A and B.
Within each workspace, I can run yarn start to run webpack dev server on different ports.
Therefore, I am trying to use the command yarn workspaces run start to ...
3
votes
1
answer
4k
views
How to execute root dependency from Yarn workspace with Zero Install and PnP
I'm trying to setup a monorepo with Yarn Workspaces, Zero Install + PnP (no node_modules, but instead a .yarn/cache inside the root).
Since I don't want to define dependencies such as typescript ...
3
votes
1
answer
4k
views
unable to add package in yarn workspace monorepo
I am trying to import components in a shared package in a monorepo, but am unable to do so.
I have the following package.json files under the root of a repo that I want to run as a monorepo. /apps/...
3
votes
1
answer
1k
views
Storybook is loading stories from a yarn/lerna monorepo's packages' node_modules folder
I'm using storybook in a lerna/yarn workspaces monorepo. I noticed today that storybook is trying to load stories from packages/**/node_modules/@scope/foo/stories/foo.stories.js I've tried logging out ...
3
votes
0
answers
200
views
Yarn monorepo performance issues during development: Many "The code generator has deoptimised the styling" messages
My monorepo looks as follows:
app1
packages/package1
packages/packageN
This is a yarn 3 monorepo with turborepo for caching build assets.
App1 consumes package1.
App1 is a simple Vite React app.
...
3
votes
0
answers
439
views
Yarn monorepo & typescript paths in packages
Has anyway succeeded in making this work? We have a yarn workspace, consisting of packages and apps. E.g.:
libs
ui
src
package.json
tsconfig.json
apps
app-1
src
package.json
...
3
votes
0
answers
732
views
Use Sentry Releases in a yarn monorepo
I'm using a Yarn monorepo which contains Typescript modules that provide content to the backend. I'm using a Github Action workflow for each module to deploy it. In the shared SDK is Sentry configured ...
3
votes
0
answers
1k
views
Prune command not working on Windows & M1/M2
I have a monorepo made following turborepo's documentation, on Linux machines it builds the entire monorepo and all the docker containers flawlessly but when it comes to either Windows (WSL2 on both ...
3
votes
0
answers
515
views
yarn audit in a monorepo
We're using yarn audit extensively in our daily workflow, but we encountered an issue: in a monorepo that uses yarn workspaces yarn audit seems to scan the entire repo. Our current workaround is to ...
3
votes
1
answer
1k
views
Should I use yarn workspaces on production?
Me and a coworker are working on the deploy of some APIs that have some sharedlibs in common.
The thing is, he said that workspaces shouldn't be used in production, but no reason was presented to ...
3
votes
1
answer
3k
views
configuring webpack in yarn workspaces
I am migrating some repos to a monorepo that uses yarn workspaces with Lerna. The packages look roughly like this:
|-- packages
|-- app
|-- components-1
|-- components-2
app is bundled ...