Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
61 votes
1 answer
30k views

the difference between nx and Lerna ? (monorepos)

hello i'm in new in monorepos world and i'm now searching about different monorepos tools and i found two intersting tools Nx(nrwl) and lerna but i didn't understand the real differnce between these ...
anis's user avatar
  • 875
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 ...
Undistraction's user avatar
26 votes
6 answers
53k views

Building Typescript: [!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

I've encountered problem building typescript packages with rollup inside lerna managed monorepo. Error: lerna ERR! rollup --config ../../rollup.config.js stderr: loaded ../../rollup.config.js with ...
Kirill Morozov's user avatar
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 ...
Max Komarychev's user avatar
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
20 votes
2 answers
16k views

How Should VSCode Be Configured To Support A Lerna Monorepo?

I have a lerna monorepo containing lots of packages. I'm trying to achieve the following: Ensure that VSCode provides the correct import suggestions (based on package names, not on relative paths) ...
Undistraction's user avatar
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
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 ...
Erazihel's user avatar
  • 7,545
15 votes
1 answer
4k views

VSCode - Lerna - Typescript - Monorepo Code Navigation

We have a monorepo for all our Javascript related SDKs here at Sentry. https://github.com/getsentry/sentry-javascript If you clone this repo, set it up properly with yarn install and then open any ...
HazA's user avatar
  • 1,324
15 votes
4 answers
13k views

How do I load a package from a package in a Lerna monorepo?

I have: packages -models -package.json -.... -server -src -index.ts -package.json In my packages/server/package.json, I have: "scripts": { "dev": "ts-node src/index.ts" },...
Shamoon's user avatar
  • 42.8k
15 votes
2 answers
19k views

Lerna. Install dependencies to root project

I have standard Lerna repository like this: my-repo - package.json - packages - api - package.json - web-app - package.json If I need same dependency in both packages (for example ...
WelcomeTo's user avatar
  • 20.3k
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
14 votes
1 answer
4k views

lerna link vs. lerna bootstrap

I have a Lerna project which until recently was using lerna bootstrap --hoist. This worked well but I found the devDependencies in the many sub folders were mostly identical. Upgrading to Lerna v3 I ...
user2965155's user avatar
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
11 votes
0 answers
3k views

How to generate per-package package-lock.json for existing Lerna mono-repo

We have an existing Lerna mono-repo that has a structure like: / /packages /package1 /package2 /package3 ... We currently use Yarn for our project, and actually only have a top-...
Matthew Herbst's user avatar
10 votes
5 answers
12k views

Lerna always lists all packages ready to publish when running workflow of Github actions

Lerna does not correctly detect packages change during running workflow of Github actions. If I make none packages related changes, commit and runlerna updatedlocally. it tells me No changed packages ...
eded's user avatar
  • 3,918
10 votes
1 answer
3k views

How to Share Build Scripts In Lerna Packages

I have a lerna repo that contains multiple packages organised in the usual structure: package.json /packages - alpha package.json - bravo package.json - charlie package.json I need ...
Undistraction's user avatar
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
10 votes
0 answers
860 views

How do you share uncompiled typescript between React Native and Next.js in a monorepo?

I have settled a monorepo with Lerna and Yarn Workspaces with this structure: project | - packages | - ReactNativeApp | - NextJsApp | - FirebaseCloudFunctions | - Common | - ...
Xiiryo's user avatar
  • 3,207
9 votes
1 answer
4k views

Lerna / Nx / Turborepo or other monorepo systems for non-js apps (php)

I have repository with /frontend (JS/Vue) and /backend (PHP) and docker-compose.yml for development. But now I need to add another JS frontend that will be sharing some components, libs etc. I do not ...
norr's user avatar
  • 2,042
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
1 answer
3k views

Type definitions for peer packages in TypeScript monorepos: development vs production

I have a monorepo project that uses yarn workspaces and lerna; all its parts are written in TypeScript. The modules are located in subfolders like packages/module-n and each module has its own package....
Alexander Kachkaev's user avatar
8 votes
2 answers
15k views

How to use lint-staged in a lerna monorepo to run the same command in all packages?

I have the following root package.json: { "name": "project", "private": true, "workspaces": [ "packages/*" ], "scripts": { ...
user avatar
8 votes
2 answers
3k views

How to configure Webpack to load a module from its src folder instead of dist?

I am working on a monorepo and therefore I want Webpack to load my sources from src instead of dist (dist is specified in package.json). For example given the following structure: /packages/core/...
Kai Sellgren's user avatar
  • 29.6k
8 votes
0 answers
2k views

Lerna avoid symlink

I'm using the below command lerna bootstrap --hoist I want lerna to install all dev and prod dependencies of the packages to the main root node_modules. Some packages are dependencies of each other. ...
javauser35's user avatar
  • 1,255
7 votes
3 answers
3k views

creating a monorepo without hosting on a package registry and installing via bitbucket

At my organization, we are trying to create a monorepo of react components so they can be used on several sites. We currently have a repo called react-components hosted on bitbucket and we wanted to ...
James Daly's user avatar
  • 1,386
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
7 votes
0 answers
620 views

Deduplicating assets in a monorepo

My file structure is as follows: - packages - app1 - node_modules - shared - public - svg1 - src/pages - app2 - node_modules ...
slider's user avatar
  • 2,766
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 ...
Undistraction's user avatar
7 votes
0 answers
4k views

Connect local packages in monorepo with lerna

I'm trying to setup a Monorepo with Lerna and yarn workspaces, but the thing that I cannot get to work is where I try to add packages as a dependency of an other local package So, what does that mean ...
Jeanluca Scaljeri's user avatar
6 votes
2 answers
3k views

Can't resolve 'fs' in firebase-admin/lib' when using nextjs monorepo project with lerna

I have a Lerna MonoRepo project setup. Like root/ lerna.json packgae.json package.lock.json packages/ app1 - Create react app (with firebase sdk dependency) app2 - Next Js ...
paritosh raj's user avatar
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 ...
Mark's user avatar
  • 10.6k
6 votes
2 answers
2k views

What is a correct approach to a javascript monorepo

I'm trying to figure out correct approach for a javascript monorepo. Imagine monorepo containing packages / libraries: root - node_modules - packages + lib-a * node_modules +...
user3056783's user avatar
  • 2,536
6 votes
1 answer
4k views

How Can I Fix VSCode Import Path Suggestions In Lerna Monorepo?

VSCode does a great job with autosuggesting imports, however inside a (Lerna) monorepo it only suggests relative paths from one package to another, for example: import example from '../../../@scope/...
Undistraction's user avatar
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 ...
Clement's user avatar
  • 4,010
6 votes
1 answer
2k views

with lerna monorepo, how to reference different versions of a shared package?

New to lerna and monorepo, my understanding is with lerna, we put all shared packages and all consumer packages in a single repo. Then after 'lerna bootstrap', consumer1 and consumer2 will both have a ...
Nan Li's user avatar
  • 593
6 votes
1 answer
3k views

How do you publish and install a private npm package to GitHub packages as an organisation?

We have a monorepo with a shared package called "@myorganization/common", that is used by both the app and Google cloud functions. Google cloud functions requires that the package is ...
Xiiryo's user avatar
  • 3,207
6 votes
1 answer
2k views

Dealing with Docker images in a Javascript/Typescript monorepo with unpublished packages

I've been trying to find a clear answer to this problem, but unfortunately I haven't been able to. There are two similar SO questions that touch on this subject, Should a developer be able to create a ...
McFlurriez's user avatar
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 ...
abnormi's user avatar
  • 668
6 votes
0 answers
1k views

lerna not generating node_module in packages

I have a monorepo with Lerna and typescript with a basic structure - root package.json - packages package-A package.json src package-B package.json ...
AngularDebutant's user avatar
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
2 answers
9k views

Can Lerna bump prerelease version according to the Conventional Commits specification?

It doesn't seem that Lerna 3.20.2 is able to bump prerelease versions (e.g. 1.0.0-alpha.0) according to the Conventional Commits specification. I made a Minimal Reproducible Example if you want to ...
customcommander's user avatar
5 votes
1 answer
7k views

Monorepo with Lerna and TypeScript fails to import package by path alias

I am trying to setup a TypeScript based monorepo using Lerna where I have two packages, bar and foo. foo imports bar by path alias and fails doing so. tree . ├── lerna.json ├── package.json ├── ...
pzaenger's user avatar
  • 11.8k
5 votes
1 answer
2k views

How to use Typescript's references and build mode to compile a mono repo to a serverless bundle?

Typescript recently introduced a new feature to work with monorepos: references. By specifying references you can build all interdependent packages using tsc -b (see also this blog post) This seems ...
Tom's user avatar
  • 8,028
5 votes
1 answer
2k views

Why vscode doesn't intellisense function inside packages in typescript monorepo?

I created a monorepo with lerna (the code in github). Inside I have two packages each package export sum function. In app1 folder I want to import this function but vscode doesn't find the function. ...
Shlomi Levi's user avatar
  • 3,257
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
543 views

Bundle Prisma Client in a module

I'm having questions, on prisma generated clients, maybe I'm doing things wrong. I Have a monorepo with the following modules dependency tree: Module A - |- Module C Module B - Module A ...
Quadear's user avatar
  • 487