DEV Community

Gaurav Saini
Gaurav Saini

Posted on

1

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

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!

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (2)

Collapse
 
kostyatretyak profile image
Костя Третяк

Try Project References. As an illustrative example, you can use the Ditsmod repository, where this feature has already been implemented.

Collapse
 
gal1419 profile image
Gal Malachi

@sainig what did you end up doing?

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay