Skip to content
RESN
GitHub

Package Manager

Why pnpm?

  • pnpm has numerous benefits over npm and yarn.
  • Instead of downloading packages each time you run install, it stores all packages in a global store which works across all your projects.
  • When running install, instead of extracting into the node_modules folder, it uses syslinks to make a reference - this is incredibly fast.
  • Additionally, pnpm has the best monorepo workspaces out of all the package managers, without requiring addition of a tool to manage monorepos (e.g. Lerna).
  • No matter which folder in the monorepo you run pnpm install from, it’ll still know it’s in the monorepo and not break the pnpm-lock.yaml in the root directory.
  • NOTE: We use the shamefully-hoist option because many packages were not designed with pnpm in mind - this improves compatibility.

Linking Monorepo Packages

  • Ensure the package is properly exported in package.json (e.g. "main": "src/index.ts")
  • In the importing project’s package.json, add "package-name": "workspace:*" to its dependencies
  • Re-run pnpm install to set up the reference