mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Enable Turbopack filesystem cache for dev by default Remove the canary block on the option for builds, but that remains false by default
49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
---
|
|
title: Turbopack FileSystem Caching
|
|
nav_title: turbopackFileSystemCache
|
|
description: Learn how to enable FileSystem Caching for Turbopack builds
|
|
---
|
|
|
|
## 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.
|
|
|
|
> **Good to know:** The FileSystem Cache feature is considered stable for development and experimental for production builds
|
|
|
|
```ts filename="next.config.ts" switcher
|
|
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
|
|
```
|
|
|
|
```js filename="next.config.js" switcher
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
experimental: {
|
|
// Enable filesystem caching for `next dev`
|
|
turbopackFileSystemCacheForDev: true,
|
|
// Enable filesystem caching for `next build`
|
|
turbopackFileSystemCacheForBuild: true,
|
|
},
|
|
}
|
|
|
|
module.exports = nextConfig
|
|
```
|
|
|
|
## Version Changes
|
|
|
|
| Version | Changes |
|
|
| --------- | -------------------------------------------------------------- |
|
|
| `v16.1.0` | FileSystem caching is enabled by default for development |
|
|
| `v16.0.0` | Beta release with separate flags for build and dev |
|
|
| `v15.5.0` | Persistent caching released as experimental on canary releases |
|