MENU
Build Cache
Next.js maintains a Build Cache to speed up the building of your app.
As you build your app for the production server, the compiler will create a Data Cache containing all the results of the fetch() requests, and a Full Route Cache to avoid re-rendering components on-the-fly unnecessarily.
Rebuilding the app won't clear the Data Cache.
Duration
The Build Cache persists across deployments.
Revalidation
To refresh the build cache, remove its directory:
rm .next
Opting Out
You can configure your build scripts (package.json) to clear cache directories or set up cache policies in deployment environments to avoid persistent caching across builds:
"scripts": {
"build": "rm -rf .next/cache && next build"
}