本页还没有译文
本页 5 段还没译成日本語,下面显示的是英文原文。serverComponentsHmrCache
还没翻译译自英文(nextjs.org)本页 5 段都还没译
The experimental serverComponentsHmrCache option allows you to cache fetch responses in Server Components across Hot Module Replacement (HMR) refreshes in local development. This results in faster responses and reduced costs for billed API calls.
By default, the HMR cache applies to all fetch requests, including those with the cache: 'no-store' option. This means uncached requests will not show fresh data between HMR refreshes. However, the cache will be cleared on navigation or full-page reloads.
You can disable the HMR cache by setting serverComponentsHmrCache to false in your next.config.js file:
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
serverComponentsHmrCache: false, // defaults to true
},
}
export default nextConfig/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsHmrCache: false, // defaults to true
},
}
module.exports = nextConfigGood to know
For better observability, we recommend using the logging.fetches option which logs fetch cache hits and misses in the console during development.