Back to BlogNext.js

Next.js 16.3: Turbopack Gets Memory Eviction, Persistent Builds, and a Rust Compiler

Next.js 16.3 ships four Turbopack improvements: memory eviction for unbounded dev-session growth, experimental persistent build cache for CI, a Rust port of the React compiler with 20-50% faster compilation, and import.meta.glob for Vite-compatible dynamic imports.

Next.jsTurbopackReact CompilerBuild PerformanceRust
Next.js 16.3: Turbopack Gets Memory Eviction, Persistent Builds, and a Rust Compiler

What Shipped in Next.js 16.3

Next.js 16.3 landed on June 29th with four Turbopack improvements that have been quietly needed for a while: memory eviction, persistent build cache, a Rust port of the React compiler, and import.meta.glob support. Most of them are the kind of fixes you don't notice until you stop suffering.

If your dev server has been climbing past 3GB RAM after a few hours of work, read on.

The Memory Problem Turbopack Had

Turbopack's in-memory cache has always grown without bound. Every route you visited during a dev session got cached — intentionally, to make subsequent navigations fast. But after a few hours of work, that cache kept accumulating. The only fix was restarting the server and losing your warm state.

The 16.3 fix is eviction. Turbopack can now drop cached results from memory and fall back to the filesystem. It builds on file-system persistence from Next.js 16.1, where Turbopack started writing cache entries to disk. Those disk entries used to be only for cold starts; now they're the eviction target during live sessions too.

The practical result: memory usage plateaus instead of climbing. When the memory cache fills up, older entries get pushed to disk rather than staying pinned. No more killing the dev server after four hours of work just to reclaim RAM.

Persistent Cache for Builds (Experimental)

The second change is persistent filesystem caching for next build — the production build, not just dev. It's opt-in for now:

// next.config.js
const nextConfig = {
  experimental: {
    turbopackFileSystemCacheForBuild: true,
  },
};

module.exports = nextConfig;

With this enabled, Turbopack writes build artifacts to disk. Subsequent builds — same machine or a CI runner with a warm cache — skip recompiling unchanged modules. Cache keys are content-addressed, so upgrading a package doesn't serve stale output; it just misses and rebuilds that module cleanly.

This is where CI starts getting interesting. If your CI runner persists .next/cache between runs, you get incremental builds without additional tooling. Most Next.js CI caching before 16.3 only helped webpack — Turbopack was starting cold every time regardless. This flag changes that.

The experimental flag exists because cache invalidation is still being hardened. Enable it in non-production CI pipelines, watch the changelog before relying on it for production deploys.

The React Compiler Got a Rust Port

The React team published a native Rust rewrite of the compiler, and Turbopack integrated it in 16.3. Early benchmarks against large apps showed 20–50% faster compilation.

To enable it:

// next.config.js
const nextConfig = {
  experimental: {
    reactCompiler: {
      compilationMode: 'annotation', // or 'all'
    },
  },
};

module.exports = nextConfig;

The compiler's behavior is unchanged — it still analyzes your components for memoization opportunities and injects optimized output. The Rust port just does that analysis faster. And because Turbopack re-runs the React compiler on every changed file during HMR, the speed improvement hits every incremental rebuild, not just cold starts.

compilationMode: 'all' applies the optimizer to every component. 'annotation' only processes components you've opted into with 'use memo'. Annotation mode is the safer default for codebases that haven't been audited for React Compiler compatibility — some patterns around refs and side effects don't play nicely with the optimizer yet.

import.meta.glob

Smaller feature, but worth knowing: import.meta.glob now works in Next.js. This is the Vite API for dynamically importing groups of files by glob pattern.

// Old webpack-era pattern
const pages = require.context('./content', true, /\.mdx$/);

// Now
const pages = import.meta.glob('./content/**/*.mdx');

The return is an object keyed by file path, with values as dynamic import functions:

const modules = import.meta.glob('./content/**/*.mdx');

for (const [path, importFn] of Object.entries(modules)) {
  const mod = await importFn();
  console.log(path, mod.default);
}

Eager loading bundles everything upfront:

const modules = import.meta.glob('./content/**/*.mdx', { eager: true });

Libraries that previously needed separate Vite and webpack adapters can now ship one code path that works in both. It's also a useful signal: Turbopack is getting closer to Vite parity on the API surface, which matters for the framework-agnostic tooling ecosystem.

Should You Upgrade?

16.3 is a patch within Next.js 16. The breaking surface is minimal.

  • **Memory eviction** is automatic — nothing to configure, works immediately on upgrade.

  • **Persistent build cache**: experimental.turbopackFileSystemCacheForBuild: true. Safe for non-production CI.

  • **Rust React Compiler**: experimental.reactCompiler. Use annotation mode unless you've audited your components.

  • **import.meta.glob** just works with no config.

npm install [email protected]

If you're on Next.js 16, there's no reason not to upgrade. If you're still on 15, this release isn't the forcing function by itself — but the gap is widening. The persistent cache and Rust compiler together are laying the foundation for build times that don't scale linearly with app size. Get on 16 before those features become load-bearing.