I’m facing a bit of a challenge to configure a monorepo with pnpm workspaces.
Saying I have the following structure:
apps
- application1
- application2
packages
- @my-project/package1
- @my-project/package2
- @my-project/package3
My pnpm workspace configuration is fairly simple:
# pnpm-workspace.yaml
packages:
- 'apps/**/*'
- 'packages/**/*'
How do I reference packages into apps?
package.json
{
"dependencies": {
"@my-project/package1": "workspace:*",
"@my-project/package2": "workspace:*",
"@my-project/package3": "workspace:*",
}
}
So far, so good. All my applcations run and the dependencies work exactly as expected. However, I have a bit of a problem.
One of my applications is a NestJS backend service. It references some of those libraries. Whenever I change something on the NestJS application itself, the “hot reload” functionality works seamsly. Whenever I change anything on any of the referenced packages, I need to stop my NestJS service, re-install its dependencies and start the application again in order to make it seeing my latest changes.
Do you guys know if there is a way to configure the NestJS application/Typescript or something to, whenever something is changed on the packages, they are built and its dist is already set to the apps I’m running?
Thank y’all!