Turbopack 文件系统缓存使 Turbopack 能够减少跨 next dev 或 next build 命令的工作量。启用后,Turbopack 将在构建之间将数据保存并恢复到 .next 文件夹中,这可以显著加速后续的构建和开发会话。
提示: 文件系统缓存功能尚处于测试阶段(Beta),仍在开发中。采用此功能的用户可能会遇到一些稳定性问题。我们建议首先在开发环境中使用它。
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/** @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| 版本 | 变更 |
|---|---|
v16.0.0 | Beta 版本发布,带有独立的构建和开发标志 |
v15.5.0 | 持久化缓存作为实验性功能在 Canary 版本中发布 |