Hello everyone,
I've been developing a medium complexity app for sometime now and I'm encountering some issues when trying to refactor my code, using dependencies between my level 1 modules.
I think I'm doing some kind of obvious mistake somewhere but I can not figure it out.
Here is the problem: I need to build 2 applications to deploy separately, but I want them to share a "commons" module. I am using npm workspaces to do so with 3 level 1 modules : commons, backend-profile and backend-budgeting.
My folder tree looks like this:
projetroot
|_ commons
| |_ src
| |_ auth
| |_ guards
| |_ jwtAuth.guard.ts
| |_ auth.controller.ts
| |_ auth.module.ts
| |_ auth.service.ts
| |_ user
| |_ user.controller.ts
| |_ user.module.ts // imports the auth.module
| |_ user.service.ts
| |_ package.json
| |_ commons.module.ts
|_ backend-profile
| |_ src
| |_ profile
| |_ profile.controller.ts
| |_ profile.module.ts
| |_ profile.service.ts
| |_ package.json // imports the commons module as a dependency - see below
|_ backend-budgeting
| |_ src
| |_ budgeting
| |_ budgeting.controller.ts
| |_ budgeting.module.ts
| |_ budgeting.service.ts
| |_ package.json // imports the commons module as a dependency
|_package.json // defines npm workspaces 'commons' and 'backend'
In my backends package.json, I have created a dependency using npm install commons@../commons, resulting in:
backend-profile/package.json
"commons": "file:../commons"
When I make a nest build of the commons module, everything works fine.
see next post ⏬