Questions tagged [monorepo]
A monorepo is a single repository containing more than one project (in contrast to the single-repository-per-project approach).
monorepo
1,432
questions
5
votes
2
answers
7k
views
How to specify path to build a package for azure-pipelines.yml in a Mono-Repo?
I have a monorepo with a folder structure like this:
root
->packageA
->packageB
->packageC
How can I alter the azure-pipelines.yml to build packageA
I have tried altering the azure-pipelines.yml by ...
5
votes
2
answers
4k
views
TypeScript: Watch & compile multiple directories at the same time (monorepo)
I've been scouring the web for a solution, but haven't found anything worthwhile. Basically, I'm looking for a tool or some way to initiate TypeScript file Watching/Compiling in multiple directories ...
5
votes
1
answer
4k
views
How to setup turborepo with sveltekit and pnpm
I am trying to add Turborepo to my Svelte apps but looks like the npx create-turbo@latest command and also the examples currently only support NextJs. How can I configure it to work Svelte and ...
5
votes
1
answer
3k
views
How to set up Lerna monorepo with TypeScript
I have a core library with the following in package.json:
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"es2015": "dist/es2015/index.js",
"types": "dist/es2015/index.d.ts",
"typings": "...
5
votes
1
answer
2k
views
What is the status of npm "isolated mode" for monorepos?
As it currently stands (March 2023), there is not very much information available when you search "npm isolated mode". The initial discussion began in this github PR, which evolved into the ...
5
votes
1
answer
2k
views
Google cloud build, referencing parent folder in a monorepo
We have a monorepo setup in which each folder has a typescript / node service. There is also a shared /types folder which we pull into each project using typescript project references.
Since you ...
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
2k
views
VSCode - Turborepo - Automatic import suggestion for local packages misses the main entry point
We recently regrouped several repositories into a single monorepo using turborepo for better code reusability using local packages.
Our folder structure looks like this:
/apps
| /app1
| /app2
/...
5
votes
1
answer
873
views
Vscode extension code inside npm workspaces monorepo vsce package error
Im writing a vs code extension inside npm workspaces monorepo,
when I try to package it using vsce package, I get this error:
This extension consists of <files_count> files, out of which <...
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
├── ...
5
votes
1
answer
2k
views
Prepare standalone directory to deploy package in a monorepo using npm workspaces
I have a monorepo that uses npm workspaces.
root/
app/
package.json
server/
package.json
store/
package.json
utils/
package.json
The app/package.json file references private non-...
5
votes
1
answer
1k
views
How to add an ionic project to an nx workspace?
I have an Nx v15.9.2 workspace, to which I added a nestjs server using nx g @nrwl/nest:app my-nest-app.
I want to add an ionic project to my nx workspace, but I haven't found a good way to do this. I ...
5
votes
1
answer
4k
views
How to build Nx monorepo apps in Gitlab CI Runner
I am trying to have a gitlab CI that performs the following actions:
Install yarn dependencies and cache them in order to don't have to yarn install in every jobs
Test all of my modified apps with ...
5
votes
1
answer
2k
views
Publish NPM package that uses a workspaces as dependencies
so I have a project that I'm working on that is a Monorepo. So I have a packages directory in the root directory that contains all my npm packages. Some of these packages rely on eachother e.g. in a ...
5
votes
3
answers
7k
views
Nx shared asset library
I want my React app in my Nx monorepo to retrieve all the assets in my asset library called common-assets.
I managed to do it with my NextJS app like so :
project.json of my NextJS app
{
"$...
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 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 ...
5
votes
2
answers
1k
views
Unique .env file in monorepo
I am trying to get to an understanding of what the best approach is to handling environment variables in a monorepo. I am using turborepo and the project structure is organised into a /apps and /...
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
2
answers
3k
views
Dependencies in Monorepo
In a monorepo, if you have a dependency in one package can you use that dependency in another package without adding it to that package? For more clarity, check the below layout.
Project
|-packages
...
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.
...
5
votes
1
answer
4k
views
How to I get hot module reloading to work in a typescript monorepo
So I've been trying for the last few days completely in vain to get hot module reloading working in my Typescript/React/Koa/Mongo based monorepo; I feel like I've been banging my head against a brick ...
5
votes
1
answer
11k
views
Jest Testing with Bazel Throws "Module ts-jest in the transform option was not found"
I have a working Bazel BUILD file that looks like this:
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@...
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
536
views
Codecov doesn't recognize flags from codecov.yml config
Recently I migrate from 3 different repos to one monorepo and setup folowing .codecov.yml adding flags option. However, Codecov seems to ignore it and keeps reporting that no flags where provided.
...
5
votes
1
answer
3k
views
How to use eslint plugin modules located in parent directory?
I have some services organized into a monorepo in such a fashion:
repo_root/
├── services/
│ ├── service_one/
│ ├── service_two/
│ └── service_three/
├── package.json
├── node_modules
├── ....
5
votes
1
answer
4k
views
What is a sensible structure for multiple-language project in source control?
At work we're developing a large-scale application with quite a few front-end, back-end and support components. Typically the front-end is developed in C# and the back-end is developed in Java, ...
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.
...
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 ...
5
votes
1
answer
1k
views
Nx monorepo: elsint can not resolve paths with @ specified in tsconfig.base.json (import/no-unresolved
I'm working on an NX monorepo project. I have linting configured. I have:
.elsintrc.json
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [
...
5
votes
1
answer
5k
views
How to fix the error: "No Next.js version could be detected in your project." when deploying to Vercel with Turborepo and pnpm
I am trying to deploy the Turborepo example app to Vercel using instructions from here, and getting the error:
Error: No Next.js version could be detected in your project. Make sure `"next"` ...
5
votes
2
answers
4k
views
tailwindcss directives not working with style file outside of project
I'd like to use tailwindcss for my styles in a nx monorepo.
I made a global style lib with a global-styles.scss file to keep the global styles that should be added to every app.
@tailwind base;
@...
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 ...
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
2
answers
8k
views
jest coverageDirectory configuration for project inside monorepo
I have a typescript monorepo with jest. Their jest.config.js is
module.exports = {
clearMocks: true,
projects: ['<rootDir>/packages/**/jest.config.js'],
collectCoverage: true,
...
5
votes
1
answer
736
views
npm publish only if changed in angular monorepo
I have an angular monorepo with an "app" and a library, which is published as it's own npm package. This is done automatically on a CI environment. Until now, the library and the app have been ...
5
votes
0
answers
491
views
How to manage databases in a NX workspace
What is the best practice for managing databases in NX?
I am using Knex migrations to manage the schema of a database and would like to add this to the NX monorepo to simplify development, deployment, ...
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 ...
5
votes
0
answers
740
views
How to use two different React versions in a monorepo with Turborepo and avoid conflicts?
I'm creating a monorepo using Turborepo and have two applications in my apps folder: app-x, which uses "react": "17.0.2", and app-y, which uses "react": "18.0.2"...
5
votes
1
answer
1k
views
Error: Cannot find module '@nrwl/workspace/src/utilities/perf-logging'
I have try run Angular project of nxMonrepo and I have already install all node_modules and it didnot show any error when I try to run PS C:\Users\Dell\Desktop\MEANAPP\EAAPP> nx migrate --run-...
5
votes
0
answers
435
views
How to share node_modules between multiple docker containers in a monorepo, built with docker compose?
I have a monorepo project like this:
root
--package.json
--node_modules
--packages
----packageA (frontend)
------node_modules
------package.json
------Dockerfile
----packageB (backend)
------...
5
votes
0
answers
674
views
lerna publish push to npm, but not updating dependencies
My Monorepo is currently managed by Lerna.js.
It all works fine except for the GitHub actions workflow I use to automate the npm publishing.
The situation is as follows:
I update packages/types-lib, ...
5
votes
0
answers
2k
views
Correct turborepo filter to get "affected" workspaces on push to main
Whenever a pull request is merged to main branch, i want to run turborepo run build command only on the affected workspaces. With nx.dev, i just use the ${{ github.event.before }} SHA to set as base ...
5
votes
0
answers
197
views
Tell Rollup to also transpile imported typescript packages
I have an npm-workspaces based monorepo with two packages. workspace-a and workspace-b.
/
- package.json
- workspace-a/
- package.json
- index.ts
- workspace-b/
- package.json
- index.ts
...
5
votes
0
answers
418
views
How to bypass index.ts files in dependency-cruiser in monorepo to show real dependencies?
We have a monorepo project with this structure:
- libs
- library1
- src
- index.ts (exports lib/*.ts)
- lib
- service1.ts
- controller1.ts (
imports {...
5
votes
0
answers
597
views
How to let Webpack HMR work with Typescript monorepo on a npm workspace
I'm trying to determine how to switch our projects and libraries in a typescript monorepo using npm workspace.
After some coding on a test structure I've been able to obtain an unsustifying working ...
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 ...
5
votes
0
answers
2k
views
Cannot find module 'postcss-preset-env' error using create-react-app inside an npm workspace
I'm trying to add a create-react-app app inside a Turborepo monorepo.
Problem is that if I run npm install from the root of the monorepo and then try to start the CRA app by running npm run dev, I get ...
5
votes
1
answer
479
views
How to shield the internals of a Lerna package, so other packages cannot import them?
I am working with a Lerna monorepo. I often see one package make imports from deep inside another package, for example:
import { SomeType } from "@schema/folder/folder/file.ts"
This is ...
5
votes
0
answers
2k
views
Next.js multi zones with i18n and shared components
I am using Next.js' multi zone feature with a blog and web app so I can develop and deploy both apps independently. It was easy to set up by following their with zones example and I have set up a blog ...