pnpm Workspaces for Monorepos
Set up a pnpm workspace with a root pnpm-workspace.yaml, hoist shared dependencies, and use workspace: protocol to link local packages.
Why pnpm?
pnpm (Performant npm) is a fast, disk-efficient package manager. It stores a single copy of each package in a global content-addressable store and links to it from project node_modules. Same dependency, multiple projects = one disk copy.
Speed and Disk Savings
On a typical monorepo, pnpm installs are 2-3x faster than npm/yarn and use ~70% less disk. Massive wins for monorepos with many packages.
All lessons in this course
- Vite: Plugin System and SSR Mode
- esbuild: Speed and Limitations
- pnpm Workspaces for Monorepos
- Turbo: Caching and Task Pipelines