Help: How to watch for changes in local dependencies in monorepo?
Gaurav Saini

Gaurav Saini @sainig

About: Proud coder, gaming lover, traveller, cooking enthusiast, but sometimes I’m like (╯°□°)╯︵ ┻━┻

Location:
Jaipur, India
Joined:
Jan 27, 2020

Help: How to watch for changes in local dependencies in monorepo?

Publish Date: Jul 13 '23
1 2

Hey folks,

I am currently setting up a monorepo project using pnpm, turborepo, typescript, and nestjs.

The folder structure is like this

└── my-ts-monorepo/
    ├── apps/
    │   └── server
    └── libs/
        └── utils
Enter fullscreen mode Exit fullscreen mode

The utils library is added as a dependency in the server application.
utils is a simple typescript library with some math functions and server is a NestJS REST API.

Everything is working fine except for one thing. While running the dev server, if I make any code changes in the utils library, the changes are not picked up by the server application.

I tried running the tsc build for the utils library with the --watch flag, but no luck there also.

The dev scripts look like this

/* root package.json */
"dev": "turbo run dev"

/* apps/server/package.json */
"dev": "nest start --watch"

/* libs/utils/package.json */
"dev": "tsc --watch"
Enter fullscreen mode Exit fullscreen mode

Please help me so that the NestJS dev server can pick up code changes in the utils dependency also.

Thanks!

Comments 2 total

Add comment