Skip to content

turbopackPersistentCaching

用法

¥Usage

Turbopack 持久缓存使 Turbopack 能够减少跨 next devnext build 命令的工作量。启用后,Turbopack 会在构建之间将数据保存并恢复到 .next 文件夹,这可以大大加快后续构建和开发会话的速度。

¥Turbopack Persistent Caching 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: Persistent Caching is still under development and is not yet stable. Users adopting should expect some stability issues.

需要了解:请注意,虽然 next devnext build 可以相互共享缓存数据,但由于配置和环境变量不同,大多数缓存条目都是特定于命令的。

¥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.

ts
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  experimental: {
    turbopackPersistentCaching: true,
  },
}

export default nextConfig

版本变更

¥Version Changes

版本更改
v15.5.0持久缓存已作为实验性功能发布