Skip to content
Configurationnext.config.jsturbopackFileSystemCache
You are currently viewing the Beta version of the documentation.

Turbopack FileSystem Caching

This feature is currently available in the canary channel and subject to change. Try it out by upgrading Next.js, and share your feedback on GitHub.

Usage

Turbopack FileSystem Cache enables Turbopack to reduce work across next dev or next build commands. When enabled, Turbopack will save and restore data to the .next folder between builds, which can greatly speed up subsequent builds and dev sessions.

Warning: FileSystem Cache is still under development and is not yet stable. Users adopting should expect some stability issues.

Good to know: Note that while next dev and next build can share cached data with each other, most cache entries are command-specific due to different configuration and environment variables.

next.config.ts
import type { NextConfig } from 'next'
 
const nextConfig: NextConfig = {
  experimental: {
    // Enable filesystem caching for `next dev`
    turbopackFileSystemCacheForDev: true,
    // Enable filesystem caching for `next build`
    turbopackFileSystemCacheForBuild: true,
  },
}
 
export default nextConfig

Version Changes

VersionChanges
v16.0.0Separate flags for build and dev.
v15.5.0Persistent caching released as experimental