Skip to main content

Questions tagged [monorepo]

A monorepo is a single repository containing more than one project (in contrast to the single-repository-per-project approach).

Filter by
Sorted by
Tagged with
9 votes
1 answer
23k views

TypeScript: Error: Cannot find module when using paths

I have a monorepo containing the Back-end(NodeJS), Front-end(Angular) and Shared directory (container models shared by the front-end and back-end.) preagree-mono/ preagree-api/ preagree-app/ ...
Aaron Nebbs's user avatar
8 votes
2 answers
8k views

Angular Libraries Monorepo: Is it possible to use different versions for every library?

just a simple question I can't seem to find an answer for. I'm trying to build a monorepo which should be able to use angular-cli v8, but still being able to compile and build libraries (mainly ...
Michael Di Prisco'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 run NestJs app in Docker using nx/monorepo

I have this Nrwl monorepo with a couple of apps. One of it is a NestJs app, which runs fine as long as I do everything inside my Monorepo. However, I need to run my NestJS app inside a Docker ...
Jeanluca Scaljeri's user avatar
8 votes
2 answers
6k views

Can I have multiple babel.config.js in a monorepo?

I have a monorepo with the structure like below babel.config.js packages/ |---mobile/ |----package.json |----src/index.js |---desktop/ |----package.json |----src/index.js |---server/ ...
Ajay Poshak's user avatar
8 votes
1 answer
4k views

How to pass arguments to ng-cli through nx affected:test?

I want to pass some arguments to ng test command when running affected projects (for CI purposes). For example: ng test --codeCoverage=true --watch=false --progress=false. How it can be done through ...
nickbullock's user avatar
  • 6,499
8 votes
1 answer
3k views

"ReferenceError: exports is not defined" for a TypeScript + SvelteKit monorepo using pnpm

I'm trying to build a monorepo around my SvelteKit app, where the app and various monorepo packages are all written in TypeScript. The SvelteKit app works fine, until I try to symlink in one specific ...
Adam Tuttle's user avatar
  • 19.7k
8 votes
4 answers
7k views

NX: How to create a NX workspace in an existing empty git repository instead of creating it under a workspace name?

I have an existing repository. I have cleared all the unwanted files as I wanted to start a new NX-integrated project. But, I want to continue using the same repository as there are some files which I ...
shet_tayyy's user avatar
  • 5,665
8 votes
1 answer
2k views

webpack not bundling packages in monorepo (turborepo) then throws "unexpected token 'export'"

EDIT: Repository where issue can be reproduced easily: https://github.com/sebastiangug/turborepo-nestjs I have a turborepo project with several nestjs applications that share various packages. I've ...
SebastianG's user avatar
  • 9,217
8 votes
1 answer
2k views

How to Integrate an Angular Application into a Monorepo with Bazel?

I've spent the last weeks building a Typescript monorepo, which can be built and deployed to Kubernetes using Bazel. But the final piece of the puzzle is integrating an Angular application in to the ...
Florian Ludewig's 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
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
8 votes
2 answers
1k views

Mismatching React types in pnpm monorepo

i'm trying to convert an inherited monorepo from yarn+lerna to pnpm workspaces i'm currently getting an error due to mismatching react versions, typescript isn't picking up on the @types/react version ...
Tom Sherman's user avatar
8 votes
2 answers
3k views

pnpm & vue & vite monorepo - resolve import of alias path inside a workspace package

I'm building a monorepo of UI applications using shared components and style using pnpm, typescript, vue, and vite. While trying to leverage pnpm's workspace ecosystem to ease the development ...
RonZ's user avatar
  • 803
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
8 votes
2 answers
10k views

Jest: "Directory in the roots[0] option was not found"

I am trying to set up monorepo to run all of its Jest tests at once. In each package, I'm using react-app-rewired to get Babel to transpile code imported from other packages without ejecting from ...
mrwnt10's user avatar
  • 1,334
7 votes
1 answer
2k views

Angular console log source is always instrument.js

I'm now running Angular 12.1.0 in NX Monorepo in latest version 12.6.5. For a long time (not just with the last version) I noticed the console logs from angular components in my system are marked as ...
George Knap's user avatar
  • 1,110
7 votes
4 answers
21k views

How to change the ts path aliases for an nx application

I am importing an existing application into an NX monorepo with a file structure a little different from default apps. It looks like this: apps my-app src feature-1 feature-2 ...
plusheen's user avatar
  • 1,364
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: ...
Jim B.'s user avatar
  • 4,654
7 votes
2 answers
4k views

Styling issues in monorepo with Turborepo, SvelteKit and Tailwind

I’ve created a monorepo with Turborepo that contains 2 SvelteKit apps and 2 packages: a component library (which is also based on SvelteKit) and a configuration package. root | |- packages | |- ...
Adam's user avatar
  • 211
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: "*...
Mogarrr's user avatar
  • 383
7 votes
1 answer
7k views

How to create a types only package on NPM

I would like to create a package (monorepo or NPM) that export only types so that in my project I can import them as such import type { MyType } from '@acme/types' I have tried the following solution ...
eakl's user avatar
  • 541
7 votes
2 answers
7k views

How to share Vite config in monorepo?

I am trying to make monorepo using Turborepo. I have a lot of Vue projects there and I need to share Vite config across all applications. Here's how I'm trying to achieve this. I have package named @...
Andrew's user avatar
  • 1,005
7 votes
1 answer
5k views

Jest with tyescript in monorepo doesn't work with dependency out of the root folder

I use Jest with Typescript. I want to create a monorepo. My folders structure is: fe |-app1 |--.jest.config.ts |--tsconfig.json |-shared |--dummyData.ts I want a unit test from app1 to access some ...
eXception's user avatar
  • 1,999
7 votes
2 answers
9k views

How to deploy multiple apps (monorepo) with Azure and NX

I'm using NX tools to manage a monorepo with multiple apps and I'm struggling to understand how to deploy using Azure and release pipelines. Disclaimer : I'm very new to Azure and devops in general. ...
KevinTale's user avatar
  • 1,818
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
5k views

NX Error for Relative Imports within the Same Project

I'm getting an error when using TS aliased paths within the same project: Projects should use relative imports to import from other files within the same project I don't want this behavior. Any idea ...
S. C.'s user avatar
  • 187
7 votes
1 answer
2k views

Bazel Monorepo - How Rebuild and Publish only Changed Docker Images?

Objective I have a monorepo setup with a growing number of services services. When I deploy the application I run a command and every service will be rebuilt and the final Docker images will be ...
Florian Ludewig's user avatar
7 votes
2 answers
6k views

Difference between tsconfig.json and tsconfig.build.json

Many guides (e.g. 1, 2) on setting up NPM monorepos for a TypeScript project instruct having two separate files at the root level, tsconfig.json and tsconfig.build.json. What are the differences ...
Michael Moreno's user avatar
7 votes
2 answers
5k views

NPM Workspaces monorepo - share local package's distribution folder as root instead of the entire source files

Using NPM Workspaces, I'm sharing one package (components) with others (webapp1 and webapp2). Something like this: root apps webapp1 webapp2 packages components Everything is ...
Johnny Oshika's user avatar
7 votes
1 answer
2k views

Limiting uses' access in a monorepo

If you're working on a large monorepo, and you wanna limit some users' access to specific directories (packages) in that monorepo, is there a better way to do this than using git submodules? For ...
Amr Elsekilly's user avatar
7 votes
1 answer
4k views

Git Subtrees vs Monorepo

We recently decided to move from TFVC to Git and I'm trying to find the best way to design our new Git architecture. Our code is made of independent but tightly coupled modules, let's look at the ...
Michael's user avatar
  • 796
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 ...
MichaelA58's user avatar
7 votes
2 answers
5k views

Trigger pipeline build from sub directory in a monorepo

We're interested in moving a monorepo to git and would like to integrate it with a pipeline based CI/CD. The general pattern we've seen so far is a single pipeline description file at the root of the ...
J Dunbar's user avatar
7 votes
1 answer
2k views

Turborepo set order of execution for dev pipeline

I have following scenario: /apps /api /web /packages /shared api and web have a dependency on shared. They are both installed with workspace: * using pnpm. My turbo.json looks like this: {...
JC97's user avatar
  • 1,600
7 votes
1 answer
4k views

How to import absolute paths in a @nrwl/nx monorepo?

I'm working on a @nrwl/nx monorepo. I want to import the folders inside the project src by the absolute paths. I tried specifying the baseUrl but didn't work. The only solution worked is, adding the ...
Sennen Randika's user avatar
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
1 answer
2k views

How to setup lint-staged with turbo monorepo?

I have a turbo monorepo, with packages/... and apps/app-a, apps/app-b . I have set up husky pre-commit hook, which will run pnpm dlx lint-staged I want lint-staged to run lint script from the closest ...
Nez Nez's user avatar
  • 103
7 votes
0 answers
3k views

When using npm workspaces, how to force a package to be installed in the relative node_modules?

Here are some related questions: When using yarn workspaces, how to force a package to be installed in the relative node_modules? NPM 7 Workspaces - Multiple node_modules? Should I have to use no-...
TrumanGao's user avatar
7 votes
2 answers
8k views

How to use monorepo packages with nestjs using turborepo?

Here's what a real simple monorepo with nestjs using turborepo looks like: . ├── README.md ├── apps │   └── nest │   ├── README.md │   ├── nest-cli.json │   ├── package.json │   ├── ...
SugarMouse's user avatar
7 votes
0 answers
789 views

How to pass arguments to filtered workspaces separately using Turborepo?

My use case is, I have two workspaces say foo and bar, and I want to pass the different command line args, is it possible to achieve such functionality with Turborepo. I want to do something like this:...
Victordanny's user avatar
7 votes
0 answers
1k views

Command to build/run typescript project with NX

I am trying to run typescript file (within an app) that depends on a couple libraries with NX but I can not figure out how to do it. I've tried numerous methods, here are a couple ways I tried: First ...
David Van Isacker's user avatar
7 votes
1 answer
2k views

"Error: Invalid hook call." when importing React component from shared component library in monorepo (turborepo & npm workspaces)

I've been setting up a monorepo with the goal of creating a shared component library to use for several different Next.js apps (following this example) but whenever I import a component from the ...
jbaumann's user avatar
  • 211
7 votes
0 answers
2k views

how can i use absolute paths in same library in NX monorepo

I am working on Nx monorepo. We have 5 library and are using imports like this '../../components/Button' in library. but instead of this, we want to use absolute imports. For example: there are 2 ...
efdali's user avatar
  • 71
7 votes
2 answers
4k views

TypeScript tsc type check with references in monorepos

I'm using Yarn Workspaces, and I want a cli-command to check the types of my source ts files located at packages/*. Originally I build my project by using webpack (with esbuild, which does not check ...
swwind's user avatar
  • 155
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
1 answer
1k views

Install Python package from monorepo

We have a private git monorepo which hosts a number of Python packages. Poetry was the dependency management tool initially chosen for the project. Anyway, due to this Poetry issue, it would not be ...
hblanco's user avatar
  • 126
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
7 votes
0 answers
7k views

Passing all node_modules path to AWS CodeBuild cache

Currently I'm using AWS CodeBuild to deploy my monorepo project and I'm trying to use its cache properties. I want to cache my node_modules folder and my buildspec.yml is: version: 0.2 phases: ...
Pedro Arantes's user avatar

1 2
3
4 5
29