PNPM popularity is growing rapidly, is it time to ditch npm & yarn?
We've been using npm for years, then yarn came and gained tons popularity. Today we'll talk about pnpm, which gives a huge benefit not available in yarn/npm
We've been using npm to manage node modules for years, until Yarn
came and started to gain huge popularity. Although Yarn version 2 (released
days ago) introduces many performance improvements, rewritten in TypeScript,
and more, but still neither
NPM nor Yarn address a very important issue, which is disk space usage, this
is specifically where pnpm comes in.
Welcome to a new devspedia story, we'll briefly discuss pnpm, a Node package manager similar to NPM & Yarn, but with one great benefit, which is greatly reducing disk space consumed by node modules across all your different projects.
How it works?
pnpm saves disk space by simply downloading the packages of your project into
a common place on your computer, and then it adds hard links inside your node_modules directory.
So imagine you have 100 projects, each of them is using [email protected], with npm and yarn, this means you'll have 100 copies of this specific
version of lodash.
However, with pnpm, you'll always have only 1 copy, which will save you plenty disk space.
Is it fast as yarn?
Well, yes, and some times even faster, check the benchmarks results below, performed on a standard React App:
There are more benchmark tests made with other different scenarios, you can find all tests below:
Hope you enjoyed today's story, maybe give pnpm a try?
Thanks for reading devspedia, I love you, and I'll see you the next time.