← Semua picks

Tool Review Recommended

Bun vs pnpm vs npm: package manager untuk Astro project

Saya pakai keduanya untuk 8 Astro project sejak 2024. Bun install 8-12x lebih cepat dari npm, 2-3x lebih cepat dari pnpm. Tapi ada tradeoff.

23 April 2026 · 7 menit
Bunpnpmnpmyarn

TL;DR

  • Bun: Recommended untuk Astro project di Indonesia. 8-12x install speed vs npm.
  • pnpm: Recommended jika butuh strict node_modules linking (monorepo) atau Windows compat.
  • npm: Default safe option, lambat tapi work everywhere.
  • yarn: Skip — pnpm sudah cover yang yarn unique.

Konteks

Pakai 4 package manager untuk Astro project sejak 2024:

  • 5 project dengan Bun (current default)
  • 2 project dengan pnpm (klien dengan Windows-heavy team)
  • 1 project dengan npm (legacy, klien dengan CI/CD constraint)

Install speed benchmark

Setup: Astro project fresh, 15 dependencies (Astro, Tailwind, React, Resend, dll).

Hardware: M2 Mac, internet Jakarta fiber 100 Mbps.

ToolFresh installCache hit (re-install)
Bun 1.34.2s0.6s
pnpm 912.8s3.1s
yarn 418.5s4.9s
npm 1138.2s12.4s

Bun 8-9x faster than npm, 3x faster than pnpm.

Saving per pnpm install: 8-10 detik. Per developer doing install 5x/hari = 40-50 detik. Per 5-dev team per bulan = ~150 menit.

Bukan paling impactful saving, tapi noticeable.

Disk space

node_modules size untuk same Astro project:

Toolnode_modules size
npm245 MB
Bun188 MB (bun uses smarter dedup)
pnpm95 MB (hard-link to global store)
yarn (Plug’n’Play)8 MB (no node_modules, uses .yarn folder)

Untuk laptop dev dengan SSD terbatas (256GB), pnpm signifikan saving terutama kalau Anda manage 10+ project.

CI compatibility

Vercel

  • npm ✓
  • yarn ✓
  • pnpm ✓
  • Bun ✓ (sejak Q3 2024)

Cloudflare Pages

  • npm ✓
  • yarn ✓
  • pnpm ✓
  • Bun ✓ (since 2024)

Netlify

  • npm ✓
  • yarn ✓
  • pnpm ✓
  • Bun ✓ (Q4 2024)

Self-hosted (Docker, VPS)

  • npm ✓ (built-in Node image)
  • pnpm ✓ (extra install step)
  • Bun ✓ (extra install step, atau pakai oven/bun Docker image)

Semua deployment platform support semua manager di 2026. Bun catch-up complete.

Bun specific advantages

Lockfile speed

Bun lockfile (bun.lockb) binary format. Parsing 100x faster dari package-lock.json text parsing.

Built-in scripts

Bun bisa run TypeScript langsung tanpa transpile step:

bun run script.ts        # langsung run TS
bun --watch script.ts    # dev mode dengan file watcher

Untuk dev script (codegen, migration, seed), ini saving setup time.

bun install --frozen-lockfile lebih reliable

Saya pernah encounter “lock file out of sync” error di npm CI. Dengan Bun, less common.

pnpm specific advantages

Strict node_modules structure

pnpm pakai symlink + hard-link untuk avoid “phantom dependencies”. Kalau package A install B, tapi project Anda tidak declare B sebagai dependency, project Anda tidak bisa import B.

Dengan npm/yarn, phantom dependency work — dan ini hazard (kalau B di-remove sebagai dep of A future, project Anda broken silently).

Untuk monorepo atau project enterprise, pnpm strict-ness adalah feature, bukan bug.

Workspace (monorepo) support

pnpm workspace sangat smooth untuk monorepo (multiple package dalam 1 repo). Bun workspace ada (sejak v1.1) tapi less mature.

Windows compat

pnpm runs natively di Windows. Bun original macOS/Linux, Windows support officially launched 2024 tapi masih ada occasional bug.

Untuk klien dengan Windows-heavy team: pnpm safer pilihan.

Migration

npm → Bun

# Install Bun globally
curl -fsSL https://bun.sh/install | bash

# In project root
bun install   # creates bun.lockb, downloads dependencies

# Update package.json scripts (optional, npm scripts work as-is)
# bun run dev / bun run build

# Remove package-lock.json after verifying bun.lockb work
rm package-lock.json

Total time: 5 menit. Almost zero risk.

npm → pnpm

# Install pnpm globally
npm install -g pnpm

# In project root
pnpm import   # converts package-lock.json → pnpm-lock.yaml
pnpm install  # downloads dependencies

# Test that everything work
pnpm run dev
pnpm run build

# Remove package-lock.json
rm package-lock.json

Total time: 10 menit. Sometimes encountered phantom dependency issue post-migrate (need to add missing dependency manually).

Common pain points

Bun

  • Windows native support recent: occasional bug di Windows 11. Untuk team Windows-heavy, evaluate berdasarkan project Anda.
  • TypeScript-first: kalau project Anda mostly plain JS, advantage less relevant.
  • Some npm scripts behave berbeda: -- separator differently parsed. Rarely impact, tapi worth aware.

pnpm

  • Steeper learning curve untuk pemula: symlink + global store concept butuh paham.
  • CI cache invalidation occasional: pnpm cache di CI bisa stale, butuh clear manual.

npm

  • Slow, especially di Indonesian internet: package fetch dari npmjs.org via Singapore CDN, latency 30-50ms. Bun + pnpm parallel fetch lebih efisien.

Konteks Indonesia

Internet matter untuk install speed. Dev di internet stable (Jakarta fiber 100Mbps), perbedaan 30s vs 5s tidak crucial. Dev di internet unstable (Tangerang area dengan 4G tethering, 20Mbps), saving lebih impactful.

Disk space matter untuk laptop dev senior + budget. Saya kenal banyak dev Indonesia yang pakai MacBook Air 256GB (paling murah). pnpm hard-link save 5-10GB untuk 10+ project. Worth.

Yang surprising

Saya thought “package manager doesn’t matter, hanya install time”. Setelah 2 tahun pakai Bun:

  • Workflow lebih smooth: 1 tool untuk install + run script + (optional) TypeScript transpile.
  • CI pipeline simpler: 1 step bun install && bun run build vs npm yang butuh separate caching strategy.
  • Documentation Bun lebih clear: Bun docs cover end-to-end workflow, npm/pnpm docs lebih reference-style.

Migration adalah small action, impact compound over time.

Verdict

Recommended Bun untuk:

  • New Astro project (greenfield)
  • Solo dev atau team kecil (1-3 dev)
  • macOS/Linux primary development
  • Indonesian internet condition

Recommended pnpm untuk:

  • Monorepo project (workspace)
  • Windows-heavy team
  • Strict dependency hygiene matter
  • Enterprise project dengan compliance constraint

Stay with npm kalau:

  • Legacy project dengan complex CI/CD yang tidak worth migrate
  • Team senior yang sangat familiar dengan npm specifically

Skip yarn: pnpm strictly better untuk yarn unique use case.

Ditulis oleh Asti Larasati

// Pick Tool Review lain


← Semua picks RSS feed