โ†All notes
February 20222 min readTech

Dari Yarn ke PNPM

Setelah lama pakai Yarn, akhirnya pindah ke pnpm. Lebih cepat, pesan error lebih jelas, dan makin banyak OSS yang pakai.

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).

It clearly tells me if Iโ€™m using a deprecated package, or if a newer major version is available. ๐Ÿ‘

Nice touch!

โ€” Cory House (@housecor), October 24, 2021

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.

  • faster installs
  • yarn-like resolutions
  • expressive filtering
  • workspace-specific/sparse installs

โ€” Jared Palmer (@jaredpalmer), October 17, 2021

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.

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.

โ€” Sitnik the Developer (@sitnikcode), December 24, 2021

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.

Is this common? Should I be using pnpm/yarn instead?

โ€” Wes Bos (@wesbos), January 6, 2022

More: https://pnpm.io/workspaces#usage-examples

Installation

npm i -g pnpm

Cara lain untuk install pnpm ada di sini

Reply on Twitter ยท back to all notes