trouble working with npm workspaces

Hey I'm working in a new pattern than usual which is a monorepo using npm workspaces My build failed after i introduced a shared package and it says error TS2307: Cannot find module '@local/keylib' or its corresponding type declarations. I am using the root directory config in railway. Does that throw out the code outside from workspace? This could be why it can't reference code from other workspaces. Any help?
8 Replies
Percy
Percy8mo ago
Project ID: cd11aa3e-055b-41a8-ba34-f9827ba92cfb
croissant
croissant8mo ago
cd11aa3e-055b-41a8-ba34-f9827ba92cfb
Brody
Brody8mo ago
you are absolutely correct, only the set directory is copied, for packages that share code or types you wouldn't want to set a root directory
croissant
croissant8mo ago
I see, i'll try adding custom config in my dockerfiles Would watch path be affected in any way? I don't want useless unchanged deploys
Brody
Brody8mo ago
they shouldn't
croissant
croissant8mo ago
Aight I didn't think this through. Is this still possible
ROOT
- core-service
- Dockerfile

- keymanager-service
- Dockerfile

- shared-API-clients
- keyclient
- keyclient.ts
ROOT
- core-service
- Dockerfile

- keymanager-service
- Dockerfile

- shared-API-clients
- keyclient
- keyclient.ts
I want to use the keyclient as my shared library core-service and keymanager-service are seperate railway services Will railway be able to support a monorepo structure like this or should i break it up
Brody
Brody8mo ago
yeah seems fine to me, keep the root directory as the root and set the location to the dockerfiles via the service variable https://docs.railway.app/reference/variables#user-provided-configuration-variables
croissant
croissant8mo ago
Thanks!
Want results from more Discord servers?
Add your server