Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Heroku Engineering 4 min read How-to mediumAdept

How to Use pnpm on Heroku

Heroku's Node.js buildpack now supports pnpm, and early adopters saw 10-40% faster installs than npm, thanks to pnpm's content-addressable store, symlinked dependencies and overlapping resolve/fetch/link stages. The walkthrough enables Corepack, pins pnpm with an integrity-hashed packageManager field in package.json, and builds a small Express app with a Procfile, then deploys it via git push. A committed pnpm-lock.yaml is required for the buildpack to detect pnpm, and pinning the exact package manager version keeps builds deterministic.

Related posts

  • Dependency prefixes are a supply chain risk: let's fix them

    Sourcegraph mediumAdept

    SemVer range prefixes like ^, ~ and wildcards in package.json act as a trust policy that lets compromised or hijacked packages flow into CI and production on the next install. The recommended controls are to commit lockfiles and install with npm ci, pnpm --frozen-lockfile or yarn --immutable, pin exact versions for high-blast-radius packages such as build tools, auth libraries and native-binding deps, set save-exact defaults, disable install scripts with an allowlist for exceptions, and run audits against the locked tree. To roll this out across hundreds of repositories, a Sourcegraph Batch Changes spec with a Node script rewrites React dependency ranges to approved exact versions and refreshes lockfiles without running scripts.

  • Protecting your Supabase projects from npm supply chain attacks

    Supabase mediumAdept

    npm supply chain attacks reach Supabase users through three common paths: maintainer compromise, typosquatting (including a real `supabase-javascript` package and AI-hallucinated names), and build pipeline compromise like the TanStack attack via `pull_request_target` and a poisoned Actions cache. Malicious lifecycle scripts can exfiltrate env vars, cloud metadata, kubeconfig, npm tokens and SSH keys before `npm install` even returns. The recommended layered defenses are pnpm 11 with a 3–7 day `minimumReleaseAge`, exact version pins for sensitive deps, committed and reviewed lockfiles, disabled install scripts with an allowlist, verifying `@supabase/` scopes, SHA-pinned GitHub Actions, and credential rotation after suspected exposure. A ready-made prompt lets a coding agent apply these settings across pnpm, npm, yarn and bun.

  • How to use NPM packages outside of Node

    Neon mediumAdept

    Many npm packages depend on Node-only globals like Buffer or built-ins like fs and net, which break on Vercel Edge Functions, Cloudflare Workers and browsers. Using esbuild bundling, the techniques progress from simplest to hardest: install third-party shims, inject global shims with --inject (with checks for booby-trapped Buffer and process.nextTick), add stub packages as local file: dependencies, reimplement small modules like StringDecoder and url.parse, and reimplement complex ones such as net.Socket over WebSockets. A final trick, package masquerading, substitutes a dependency (pg) with another (@neondatabase/serverless) via a same-named local package. The examples come from building Neon's serverless Postgres driver from node-postgres.

  • Introducing your new JavaScript package manager: Deno

    Deno mediumAdept

    Deno 2 adds `deno add`, `deno remove`/`uninstall`, and `deno install` subcommands that manage npm and JSR dependencies in either `deno.json` import maps or an existing `package.json`, so they work inside Node projects too. Installs use a global cache with hard links (Linux) or clonefile (macOS), like pnpm, to save disk space and speed up installs, and `--entrypoint` can pre-cache dependencies for Docker builds. Postinstall scripts are blocked by default and must be allowed per package with `--allow-scripts`. `deno outdated` and `deno update` are planned for the next release.

  • Bun v1.2.19

    Bun mediumAdept

    Bun v1.2.19 adds pnpm-style isolated installs (`--linker=isolated`) for monorepos, `bun update --interactive`, `bun pm pkg` for editing package.json, `bun why` for tracing dependency chains, and a fixed dependency-group priority order. `Bun.sql` now pipelines PostgreSQL queries automatically, making it up to ~5x faster under high concurrency, and a new `--sql-preconnect` flag warms the connection at startup. Windows standalone executables now embed code in a dedicated `.bun` PE section so they can be Authenticode-signed. Smaller changes include avoiding Zig memcpy page faults (1ms faster startup, 3MB less RAM), SIMD comment scanning, better dead-code elimination, and test runner improvements.

The quest for software engineering knowledge.

Look:
Layout: