Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
34 votes
5 answers
17k views

Sharing a typescript library in a monorepo

I'm trying to setup a monorepo with 3 services sharing some library code. This is the current situation: repo: web pdf/ package.json reference to shared-ts using github url tsconfig.json ...
Corentin S.'s user avatar
  • 5,920
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
9k views

Preventing inappropriate imports and enforcing project hierarchy in Typescript

In a TS project I'd like the following to be blocked: A file from folder common importing from folder projectA A file from folder projectB importing from folder projectA I'd like the following to be ...
Ben Carp's user avatar
  • 25.8k
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
2 answers
14k views

Extend a "paths" tsconfig file for a monorepo

I've got a folder structure like so: - mono-repo tsconfig.paths.json - Website tsconfig.json - src test.ts index.ts - Tool - src index.ts // mono-repo/tsconfig.paths....
Seph Reed's user avatar
  • 10.1k
22 votes
7 answers
16k views

Global Type Declarations within a NX and NextJS monorepo

I've been looking around the web to try and find s nice solution to my problem but so far I have not. I have a NX monorepo with NextJS and I am trying to create a global types/ folder that can be used ...
lukehillonline's user avatar
21 votes
3 answers
23k views

NPM Workspaces Typescript unable to find local modules

I have a NodeJS monorepo set up using NPM workspaces and Typescript. It works fine without Typescript, however introducing TS brings some dependency resolving errors with it. Current directory setup: +...
Brady Harper's user avatar
20 votes
3 answers
11k views

Create React App + Typescript In monorepo code sharing

I currently have a monorepo where I have two (+) packages using yarn workspaces: root /packages /common /web ... root/package.json ... "workspaces": { "packages": [ "...
Brandon's user avatar
  • 1,027
20 votes
0 answers
5k views

Typescript pnpm monorepo, path aliases conflicts between local dependencies during build

I have a PNPM with TurbeRepo monorepo, used this template. In this monorepo I have a NextJS app that uses a ui-shared package (local shared code, not actually an npm package). The ui-shared is made in ...
Nikola-Milovic's user avatar
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
18 votes
1 answer
11k views

Angular + Jest: Can't resolve all parameters for AppComponent: (?)

I am operating inside a Typescript Monorepo. I want to add an Angular 8 frontend with Jest testing to the Monorepo. But I am encountering some issues. I am using Angular CLI: 8.3.5 What I did I ...
Florian Ludewig's user avatar
17 votes
3 answers
10k views

Jest Projects in a Monorepo unable to find config files in projects

Having trouble setting up jest projects. Project A has some additional configuration that it runs (setupJest, creates some custom matchers, etc) that project B does not have. When I run jest I get ...
mycroft16's user avatar
  • 825
16 votes
3 answers
25k views

tsconfig.json shows error: Entry point for implicit type library 'glob'

I have a Monorepo which uses Typescript. I have a common folder which shows this error on the top of the file -> Entry point for implicit type library 'glob'. I am not sure what is wrong with the ...
Joshua's user avatar
  • 1,343
16 votes
2 answers
18k views

Where to configure jest in a monorepo?

I am setting up a monorepo in which I am building a react app where I will be using typescript. We want to use jest to test backend features and React-Testing-Library to test frontend features. Should ...
MarcosTacos's user avatar
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
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
2 answers
4k views

Go to Typescript Source Definition instead of Compiled Definition in Visual Studio Code

I am working on a typescript project with Visual Studio Code including multiple npm packages structured like this: Source code: /src/index.ts Compiled code: /dist/... When I right click on imported ...
Florian Ludewig's user avatar
14 votes
1 answer
17k views

Issues building a TypeScript monorepo project

I have a fairly simple mono repo. It is available on GitLab here. This uses yarn workspaces, TypeScript, Jest, ts-jest and ESLint with eslint-plugin-import. I am trying to properly build the project ...
Remco Haszing's user avatar
13 votes
1 answer
5k views

How to refresh monorepo TypeScript types in VS Code without reloading the window

I have an open source project called react-querybuilder that is maintained as a monorepo. Most of the TypeScript type definitions live in the ts package. When I have a file open in VS Code for one of ...
Jake Boone's user avatar
  • 1,250
13 votes
1 answer
5k views

How to share a global.d.ts from several packages in monorepo

I have my interface definitions of the result of several database queries in a global.d.ts file. As I moved the various project folders using those interfaces into a single monorepo, I am still using ...
Devasatyam's user avatar
12 votes
1 answer
2k views

Import shared code in Next.js app in a monorepo

I want to leverage monorepo by reusing types, DTOs, and other isomorphic app stuff from the backend (Nest.js) services within the same mono repo. In my case the next.js app and the nest.js app (which ...
DK3Z's user avatar
  • 123
12 votes
1 answer
1k views

How can i Deploy a single npm workspace which depends on packages and other workspaces?

I created a project using npm workspaces and Typescript Project References pretty much exactly like this example repo: https://github.com/Quramy/npm-ts-workspaces-example. This setup keeps all ...
Jeremias Nater's user avatar
11 votes
2 answers
11k views

Typescript eslint tsconfig resolution error in monorepo

I have the following project structure: /root /serviceA /serviceB /serviceC /serviceD Not all of the services are typescript / node based, so I want to avoid adding tsconfig into the root. ...
dendog's user avatar
  • 3,258
11 votes
1 answer
6k views

How can I get live-reload on a local npm package in a monorepo?

I'm setting up a monorepo workspace for a Vue 3 (vite + ts), cloud functions, & shared-lib (shared functions and ts interfaces etc.). I can get the import of my local shared-lib folder to work. I ...
CVE's user avatar
  • 161
11 votes
1 answer
2k views

Typescript: resolve relative import path when using symlinks

This seems like a dumb question, but I struggle to find the answer. The situation Here is my folder structure: myProject/ ├── module1/ │ ├── config.ts │ └── init.ts #symlink ├── module2/ │ ├── ...
TOPKAT's user avatar
  • 7,989
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
6k views

Nrwl / Nx - how to build single js file consumable by browser with dependencies bundled

I need to build a single js that can be used as Service Worker. I have a nrwl workspace with two @nrwl/web:lib packages, one is common and the other is worker. The worker package uses common through ...
František Žiačik'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
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
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
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
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
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
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
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
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
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
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
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
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
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
3 answers
7k views

Migrating a Create React App (Webpack) to NX and Vite - URI malformed at decodeURI

This is going to be a tricky one because there's a lot going on in here. Therefore, I'll try to be as succinct as possible not to overload you with too much information. I'm currently in the process ...
Jose A's user avatar
  • 10.8k
6 votes
3 answers
7k views

TypeORM migration with nx-Monorepo Issue

I tried this a lot but now I think I need some help. I have a nx-monorepo with angular-frontend and nestjs backend. Now I added a Postgres-SQL database with TypeORM. Everything is working fine, ...
igl1991's user avatar
  • 61
6 votes
1 answer
6k views

Expo: Cannot resolve entry file: The `main` field defined in your `package.json` points to a non-existent path

I am working with the default typescript template generated from the command line npx create-expo-app -t expo-template-blank-typescript and I get this error when I try to start the project. The main ...
TOPKAT's user avatar
  • 7,989
6 votes
5 answers
981 views

How To Implement a Buildless Pipeline in a TypeScript Monorepo

suppose I have this monorepo: /apps /apps/app1 /apps/app1/src (contains index.ts and many other files and subfolders here) /apps/app1/tsconfig.json /apps/app1/package.json /apps/app2 /apps/app2/src ...
Alex's user avatar
  • 67.5k

1
2 3 4 5
7