DEV Community 👩‍💻👨‍💻

Discussion on: Exploring the Monorepo #2: Workspaces (npm, pnpm)

ruyadorno profile image
Ruy Adorno

I see! thanks a lot for the feedback! 😄

It seems to me you were hitting one of the biggest DX hiccups (IMO) we're still yet to solve, which is the fact that in order to work with workspaces you can NOT cd into that folder (e.g: cd apps/web) - instead what you want to do is to run the command from the project root level and set a workspace config value, like: npm start -w ./apps/web

It's the same for adding new dependencies to a workspace, let's say you want to add a new dependency named path-complete-extname to a child workspace at ./apps/web, then the syntax to do so is to run from the root: npm install path-complete-extname -w ./apps/web (notice you can also just use the "name" value of a child workspace, so if the name property of ./apps/web/package.json is web then you can simply run: npm install path-complete-extname -w web

Again, thanks for the feedback! This type of real life UX report helps us a lot!