ts-node with project references in a lerna monorepo
I'm using `lerna` with typescript project references for a node application containing two packages. Package `lib` and package `app` (which depends on `lib`). I've configured typescript project references so that package `lib` is built automatically whenever we run `tsc --build` inside package `app` (i.e. to build for production). Here's how the `tsconfig.json` files are configured for each of the packages: packages/`lib`/tsconfig.json: ``` { "compilerOptions": { "strict": true, "rootDir": "src", "outDir": "dist", "tsBuildInfoFile": "dist/.tsbuildinfo", "composite": true } } ``` packages/`app`/tsconfig.json: ``` { "compilerOptions": { "strict": true, "rootDir": "src", "outDir": "dist", "tsBuildInfoFile": "dist/.tsbuildinfo", "incremental": true }, "references": [ { "path": "../lib" } ] } ``` Currently, running `tsc --build` (inside `app`) compiles typescript to javascript in the `dist` directory in each of `app` and `lib` perfectly fine, the setup runs flawlessly in production mode. The problem, however, is that trying to run the project in development with `ts-node` via `nodemon --exec 'ts-node src/index.ts'` in development fires the following error: ``` /path/to/packages/app/node_modules/ts-node/src/index.ts:245 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: src/index.ts(1,23): error TS2307: Cannot find module '@myproj/lib'. ... ``` What seems to
Posted by kerdany on Oct 16, 2019, 1:09 PM
Tags
Related issues
- Qt is fully of bugs on Wayland, some of which are unfixable because the API makes guarantees that are impossible to uphold.
- I took the plunge into GrapheneOS a week ago.
- [FEATURE] Multi-device Cowork: Allow concurrent Cowork agents on multiple machines under a single account
- [BUG] Claude Desktop spawns 1.8 GB Hyper-V VM on every launch, even for chat-only use
- Those cheap Bluetooth Tesla coils on AliExpress use A2DP audio as their control signal - a comparator converts the audio into spark pulses.
- [Prisma 7.0.0] TypeScript TS2742 errors with pnpm monorepo - cannot resolve @prisma/client-runtime-utils types
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
onboarding (SaaS)
Qt is fully of bugs on Wayland, some of which are unfixable because the API makes guarantees that are impossible to uphold.
I took the plunge into GrapheneOS a week ago.
[FEATURE] Multi-device Cowork: Allow concurrent Cowork agents on multiple machines under a single account
[BUG] Claude Desktop spawns 1.8 GB Hyper-V VM on every launch, even for chat-only use
Those cheap Bluetooth Tesla coils on AliExpress use A2DP audio as their control signal - a comparator converts the audio into spark pulses.
[Prisma 7.0.0] TypeScript TS2742 errors with pnpm monorepo - cannot resolve @prisma/client-runtime-utils types
I built a routine management app for my kids (7 and 10) called "Oh Yah!" after their constant "Oh yah!
> If it is open source, then I can build and install it myself.
ts-node with project references in a lerna monorepo
I'm using `lerna` with typescript project references for a node application containing two packages. Package `lib` and package `app` (which depends on `lib`). I've configured typescript project references so that package `lib` is built automatically whenever we run `tsc --build` inside package `app` (i.e. to build for production). Here's how the `tsconfig.json` files are configured for each of the packages: packages/`lib`/tsconfig.json: ``` { "compilerOptions": { "strict": true, "rootDir": "src", "outDir": "dist", "tsBuildInfoFile": "dist/.tsbuildinfo", "composite": true } } ``` packages/`app`/tsconfig.json: ``` { "compilerOptions": { "strict": true, "rootDir": "src", "outDir": "dist", "tsBuildInfoFile": "dist/.tsbuildinfo", "incremental": true }, "references": [ { "path": "../lib" } ] } ``` Currently, running `tsc --build` (inside `app`) compiles typescript to javascript in the `dist` directory in each of `app` and `lib` perfectly fine, the setup runs flawlessly in production mode. The problem, however, is that trying to run the project in development with `ts-node` via `nodemon --exec 'ts-node src/index.ts'` in development fires the following error: ``` /path/to/packages/app/node_modules/ts-node/src/index.ts:245 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: src/index.ts(1,23): error TS2307: Cannot find module '@myproj/lib'. ... ``` What seems to
Comments (0)
No comments yet. Start the discussion.