Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Important
Security Advisory: React2Shell & two new vulnerabilities
Find out more
Configurationnext.config.jsserverComponentsHmrCache

serverComponentsHmrCache

This feature is currently experimental and subject to change, it's not recommended for production. Try it out and share your feedback onGitHub.
Last updated June 16, 2025

The experimentalserverComponentsHmrCache option allows you to cachefetch 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 allfetch requests, including those with thecache: '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 settingserverComponentsHmrCache tofalse in yournext.config.js file:

next.config.ts
importtype { NextConfig }from'next'constnextConfig:NextConfig= {  experimental: {    serverComponentsHmrCache:false,// defaults to true  },}exportdefault nextConfig

Good to know: For better observability, we recommend using thelogging.fetches option which logs fetch cache hits and misses in the console during development.

Was this helpful?

supported.

[8]ページ先頭

©2009-2025 Movatter.jp