Why Use PNPM #
When using npm or Yarn, if you have 100 projects using a dependency, you will have 100 copies of that dependency saved on disk.
With pnpm, the dependency will be stored in a content-addressable store
Motivation | pnpm
There is a lot more information on the pnpm website including benchmarks showing pnpm is faster than npm and yarn.
📝 Benchmarks of JavaScript Package Managers
Using PNPM With Gatsby #
You will need to install gatsby-plugin-pnpm
in order to fix webpack problems.
When using pnpm, building a Gatsby project will fail because pnpm uses a unique node_modules structure, and webpack doesn't know how to resolve packages in it.
This plugin will configure webpack so that it is able to see Gatsby's dependencies.
Js-Brecht/gatsby-plugin-pnpm
gatsby-config.js
/**
* PNPM Webpack
*/
'gatsby-plugin-pnpm',
Notes #
Comparison of node_modules
size of this site
873M ./node_modules_yarn
497M ./node_modules_pnpm
The source for the site is available on github.
Webmentions
No Comments Yet