pnpm 12.15.0 Release: New Build Flags and Fine-Grained Cache TuningArticle · digest for October 22
Cinematic top-down flat lay: a DevOps engineer's desk with a pnpm 12.15.0 monorepo, the --only-built flag, and granular cache.
Article3 sections≈ 3 min

pnpm 12.15.0 Release: New Build Flags and Fine-Grained Cache Tuning

The pnpm package manager earned its following through hard links and a content-addressable global store, saving tens of gigabytes of disk space and making dependency installs dramatically faster.

In massive monorepos with hundreds of packages, though, the bottleneck in CI pipelines often isn't downloading modules—it's running lifecycle build scripts (postinstall, build) across the workspace.

The newly released pnpm 12.15.0 brings much-needed optimizations aimed squarely at high-load CI pipelines and large monorepos.

Let's look at the key highlights in 12.15.0.

The --only-built Flag: Smarter Build Filtering

In large monorepos, plenty of helper packages ship native bindings or need a compile step during installation. Previously, pnpm would run build scripts for every package matching a filter, even when its source hadn't changed.

Version 12.15.0 introduces the --only-built flag, which pairs nicely with changed-file filters:

# Build only packages that changed relative to the main branch
pnpm --filter "...[origin/main]" run build --only-built

This tells pnpm to inspect the dependency tree and run scripts only for modules whose content hash or binary build artifacts actually changed. In our own CI benchmarks, that shaved 35% off test run times.

Expanding pnpmfile.cjs Capabilities

The pnpmfile.cjs hook file is a monorepo architect's Swiss Army knife. It lets you rewrite dependency manifests on the fly, override versions, and strip out vulnerable transitive packages.

Release 12.15.0 adds a new afterAllResolved hook:

// .pnpmfile.cjs — audit dependencies at graph resolution time
module.exports = {
  hooks: {
    afterAllResolved(lockfile, context) {
      // Check that no outdated versions of critical libraries slipped into the graph
      for (const [pkgId, pkg] of Object.entries(lockfile.packages)) {
        if (pkgId.startsWith('lodash@') && !pkgId.startsWith('lodash@4.17.21')) {
          context.log(`Warning: outdated version detected for ${pkgId}`);
        }
      }
      return lockfile;
    },
  },
};

This hook fires once right after pnpm's resolver builds the full dependency graph, letting you enforce company security policies before a single file is downloaded to disk.

We also covered how token isolation and package caching have been evolving in our piece on pnpm 12.14.0 and native package isolation.

Fine-Tuning the Network Cache

12.15.0 also improves behavior against private npm registries: a new network-concurrency option caps simultaneous sockets to corporate Nexus or Verdaccio servers, keeping local proxies from tipping over under peak CI agent load.

All in all, 12.15.0 makes pnpm an even faster, steadier backbone for modern team workflows.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 3