pnpm is a package manager that saves users space and reduces build time by handling package storage differently from npm and Yarn.
When you install a package, pnpm keeps it in a global store on your machine then creates a hard link from it instead of copying, so that there is only ever one copy of a module kept on disk.
This approach saves gigabytes of disk space and provides a leaner, faster way to manage packages, which makes it ideal for a streamlined deployment environment like Heroku.
Since May 2024, pnpm is now available in Heroku via Corepack.
To get started with pnpm on Heroku, users can enable and use it with corepack after creating a new project folder.
Comparing common commands, the usage for pnpm is fairly similar to that of npm or Yarn and should be intuitive.
Users can install dependencies, build, prune devDependencies, and cache build with pnpm, which significantly speeds up build time compared to npm.
In our test, the initial build with npm using the timing buildpack took 16 seconds, while that of pnpm only took 7 seconds.
Through its storage approach, pnpm frees up substantial disk space, reduces build time in subsequent builds, and provides a faster way to manage packages, making it an attractive package manager for developers to consider.
Moreover, with its support for Heroku, it offers a seamless path to deployment in the cloud.