Dari Yarn ke PNPM
Tuesday, February 1, 2022
Semenjak Yarn muncul gue jarang banget pakai NPM sebagai package manager di ekosistem Node. Di tahun 2022 ini gue nyobain pakai NPM dan ternyata pengalamannya masih cukup lambat dibanding Yarn. Klo diperhatiin, banyak OSS yang pakai Yarn atau PNPM. Sayangnya, Yarn v2 kurang enak pada saat gue coba. Banyak breaking changes nya.
Kenapa pnpm?
Faster
Dibandingkan dengan npm, pnpm jauh lebih cepat dan lebih efisien. Mereka punya detail benchmarknya di sini
Clear Message
Outdated packages
I'm trying out pnpm (a fast, powerful replacement for npm).
ā Cory House (@housecor) October 24, 2021
It clearly tells me if I'm using a deprecated package, or if a newer major version is available. š
Nice touch! pic.twitter.com/LLNwUFKgCD
Error message
Untuk error message juga lebih enak pnpm dibanding npm. Misalnya error 401 lebih jelas pnpm outputnya. Di pnpm juga ada warning message klo peerDeps yang perlu diinstall.
Widely used in OSS
Author of Turborepo
Iām hopeful that @npmjs will get its act together quickly, but in the meantime, @pnpmjs is the (monorepo) package manager I now recommend to all @turborepo customers.
ā Jared Palmer (@jaredpalmer) October 17, 2021
- faster installs
- yarn-like resolutions
- expressive filtering
- workspace-specific/sparse installs
Author of Svelte
The Svelte team is all in on pnpm for new stuff, no regrets. If you want to make stuff as easy as possible for everyone, use npm. If you use workspaces or care about speed, use pnpm. Everything else is noise
ā Rich Harris (@Rich_Harris) December 7, 2021
Author of PostCSS
npm is behind all other package managers in most of the cases.
ā Sitnik the Developer (@sitnikcode) December 24, 2021
Yarn 1 is dead.
Yarn 2+ was created for PnP and requires too many configs for simple open source projects.
This is why I am switching to pnpm. https://t.co/5F3uN1Zc2s
Wesbos
Using npm workspaces for the first time and I'm running into all kinds of issues with it not being able to resolve packages, or nested dependencies.
ā Wes Bos (@wesbos) January 6, 2022
Is this common? Should I be using pnpm/yarn instead?
More: https://pnpm.io/workspaces#usage-examples
Installation
npm i -g pnpm
Cara lain untuk install pnpm ada di sini