Skip to main content

All Questions

Filter by
Sorted by
Tagged with
57 votes
4 answers
22k views

How to build a docker image from a nodejs project in a monorepo with yarn workspaces

We are currently looking into CI/CD with our team for our website. We recently also adapted to a monorepo structure as this keeps our dependencies and overview a lot easier. Currently testing etc is ...
33Fraise33's user avatar
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 ...
Jeanluca Scaljeri's user avatar
23 votes
2 answers
16k views

Monorepo with paths from Typescript is not working

I have monorepo (yarn workpaces) with following file structure: ├── client (workspace @client) │   ├── package.json │   └── tsconfig.json (extended tsconfig) ├── server ...
J V's user avatar
  • 733
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 ...
Xun Yang's user avatar
  • 4,289
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 ...
Tom's user avatar
  • 8,028
22 votes
2 answers
3k views

How to deploy one app from a large monorepo with dependencies to packages in the same repo to google app engine?

I have a large node.js monorepo with several applications and packages and inter dependencies. It is all managed with yarn workspaces and a little bit of lerna. Everything works great for me, however ...
Algirdyz's user avatar
  • 617
19 votes
2 answers
4k views

Are there any advantages to using Lerna with Yarn workspaces?

We're in the process of migrating our monorepo to use Lerna. Lerna supports both NPM and Yarn and furthermore allows configuration of use with Yarn workspaces. It's unclear to me whether Lerna with ...
axelyung's user avatar
  • 463
19 votes
1 answer
14k views

Using different versions of a dependency in different packages of a Yarn Workspace

I'm relatively new to using Yarn Workspaces and having a Monorepo set up, so forgive me if this has been answered. I don't believe I've found a clear answer on whether or not this is possible for a ...
Sherman Hui's user avatar
19 votes
4 answers
6k views

Firebase Functions with Yarn workspaces

We're starting to adopt a monorepo setup using yarn workspaces and we'd like to have our firebase functions inside it. The repo structure is something like: repo node_modules <- all ...
Thiago Nascimento's user avatar
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 ...
Alex Foxleigh's user avatar
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 ...
hmlee's user avatar
  • 877
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": [ &...
Ziv Levy's user avatar
  • 1,996
11 votes
1 answer
10k views

"Lerna List" and "Lerna Changed" Returns 0 Packages

Gist I have a monorepo and I am using yarn workspaces and lerna to manage it. I had no issues with it until now. I need to know all the changed packages since the last release. Issue So I run lerna ...
Florian Ludewig's user avatar
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 ...
adanilev's user avatar
  • 3,268
10 votes
0 answers
1k views

create-react-app + gatsby packages in monorepo won't both run

I'm trying to create a monorepo with these packages: a web app created using create-react-app a gatsby site a library of components etc. that the web app and gatsby app will share (which is my main ...
toranpetto's user avatar
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, ...
Undistraction's user avatar
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",...
Anton Dozortsev's user avatar
9 votes
2 answers
2k views

Flow: resolving modules in a monorepo that uses Yarn workspaces

We have a monorepo that uses Yarn’s ‘workspaces’ feature, meaning that whenever possible, Yarn will hoist dependencies to the monorepo's root node_modules directory rather than keep them in the ...
EranM's user avatar
  • 91
9 votes
1 answer
2k views

Running ESLint in project subdir yields "heap out of memory"

If I run eslint . from my project-root, it prints all errors and warnings to the console, as I would expect it to. However, when I cd into a subdirectory of the project, eslint . yields the following ...
Tim Hilt's user avatar
  • 654
9 votes
0 answers
785 views

Importing files in subdirectories when using Yarn Workspaces and Typescript

I'm having trouble porting a Yarn Workspaces monorepo to TypeScript. In the previous working version of the monorepo, moduleA could import something from a subdirectory of moduleB. The new ported code ...
shennan's user avatar
  • 11.4k
8 votes
3 answers
2k views

Compiling code from another workspace project in a nestjs api - Unexpected token 'export'

I'm trying to create a monorepo containing a NestJs API, a React app, and many other smaller projects shared between them The monorepo is set up with yarn workspaces The React app using Vite imports ...
Treycos's user avatar
  • 7,449
7 votes
2 answers
4k views

Yarn workspaces best practice when using shared library

I have a common (or not so coomon) scenario for yarn workspaces and didn't find the right guide for me online. yarn workspaces look like that: - monorepo - packages - client - admin ...
llioor's user avatar
  • 6,178
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 ...
Hamid Aghdaee's user avatar
6 votes
2 answers
3k views

How to do code sharing in NestJS through Yarn Workspaces

I'm trying to do a proof of concept for a simple monorepo application. I decided to just use Yarn Workspaces (I think Lerna maybe here is overkill) to set up my package architecture. I have a shared ...
Alfonso's user avatar
  • 1,275
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 ...
Ruben Aguilar's user avatar
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 ...
skrat's user avatar
  • 5,552
6 votes
0 answers
1k views

Wrong dependency is getting picked up in monorepo and with yarn workspaces

We just started to use monorepo and yarn workspaces for two of our main projects. One is originally built on Angular 11 and another is in React. We set up yarn workspaces, and on one project (Angular) ...
Alex A.'s user avatar
  • 2,557
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 ...
y_nk's user avatar
  • 2,234
6 votes
0 answers
3k views

typescript monorepo "@/*" alias

I'm moving my projects to a monorepo with Lerna and yarn workspace. I managed to setup the basic stuffs but I'm stuck with this issue and can't find similar problem on the web. As you can see on the ...
jeremy castelli's user avatar
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 ...
tofaelahmed's user avatar
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 ...
SebastianG's user avatar
  • 9,217
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 ...
jayarjo's user avatar
  • 16.6k
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 ...
Gabriel Colson's user avatar
5 votes
1 answer
3k views

Ambiguous aliases in Vite monorepo

The problem occurs for Vite monorepo, @ aliases are respected by TypeScript because of separate tsconfig files (can be visible in IDE) but aren't distinguished among the workspaces by Vite on build. ...
Estus Flask's user avatar
5 votes
1 answer
4k views

Monorepo with multiple '@/' path aliases - works in TypeScript but not Webpack compiler

I think this isn't possible, but worth an ask as I'm no webpack expert! We have a monorepo with lots of different workspace packages, using typescript, built using webpack. Each workspace has its own ...
Matt Bryson's user avatar
  • 2,784
5 votes
2 answers
16k views

Monorepo – Yarn workspaces Typescript Node.JS project – cannot find module when running nodemon

I've set up a monorepo using yarn workspaces for a typescript Node.JS project. Building the project works fine, however, I'm running into issues during local development. I need to manually run yarn ...
bhr's user avatar
  • 2,307
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 ...
MarTic's user avatar
  • 805
5 votes
0 answers
1k views

Creating a basic monorepo setup that can get incremental updates to packages

I would like to create a monorepo that uses very basic components (prefereably no Nx, Rush, Turborepo, etc) I want to have an "app" e.g. created by create-react-app in the repo, and then ...
Colin D's user avatar
  • 3,002
5 votes
0 answers
1k views

Yarn workspaces shared dependencies

I'm trying to build a project that uses yarn workspaces. And here's what I want to accomplish in my setup: > root > packages > client package.json - graphql > ...
SnekNOTSnake's user avatar
  • 1,347
5 votes
1 answer
15k views

Docker builds for a monorepo environment

Basically, both services foo and bar depend on a common library. Let's assume that the common package has already been published to the npm registry. | ├── packages | ├── common | | ├── src | ...
JeffMinsungKim's user avatar
4 votes
1 answer
4k views

React Native in yarn workspaces not resolving external packages

I am using yarn workspaces to create monorepo for react and react-native. I tried to add redux to @app/common and it works fine with react, but it is not resolving in native. You can see the source at ...
Faisal Manzer's user avatar
4 votes
1 answer
555 views

How can I make heroku/nodejs buildpack dump yarn logs into console instead of a tmp file?

Everything's sort of in the question, but here's some details. I have an monorepo structure like this, built on yarn workspaces: my_app/ ├─ node_modules/ ├─ packages/ │ ├─ backend/ │ │ ├─ package....
JaffParker's user avatar
4 votes
1 answer
3k views

How to create a shared package in a Turborepo (monorepo), for prisma generated models and types?

I am creating a monorepo using Turborepo consisting of multiple Nestjs microservices, and an API gateway to act as the request distributer. In each microservice, Postgres is used as a database and ...
Cytronic's user avatar
  • 201
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 │ └── ...
Janilson's user avatar
  • 1,153
4 votes
1 answer
1k views

run nestjs application with yarn berry workspace monorepo

I want to configure monorepo with yarn berry workspaces. I create nest application with cli that nest g application . in packages/mono-api-server folder here is my file tree . ├── .pnp.cjs ├── .pnp....
gun bos's user avatar
  • 51
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 ...
Pavel's user avatar
  • 4,157
4 votes
0 answers
1k views

Can I reuse React Context logic between packages in a monorepo?

I structure my code under a monorepo structure maintained with yarn workspaces. Looks roughly like this: packages/ react-hooks/ foo-app/ bar-app/ Both foo-app and bar-app are React ...
Paul Razvan Berg's user avatar
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 ...
Dac0d3r's user avatar
  • 1,817
3 votes
1 answer
4k views

How to run multiple packages in development inside a Monorepo

I've a monorepo using lerna and yarn workspaces for Frontend applications and libs. I add series of npm scripts at root package.json, to manage each package (app, lib, plugin) like the code at end of ...
Cazetto's user avatar
  • 71
3 votes
2 answers
4k views

Lerna 404 when publishing to github packages private registry

I'm attempting to build a few monorepo workspaces and publishing them to our organization's github packages. I've set my publishConfig on each package to point to the owner like so: "publishConfig": ...
Joe Methven's user avatar