Skip to content

Commit e5ad24f

Browse files
cj-vanaclaude
andcommitted
fix: Clear .next cache and use production NODE_ENV in all contexts
The Netlify Next.js cache was restoring stale build artifacts causing the global-error prerender failure. Now explicitly clearing .next before each build and using NODE_ENV=production consistently. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f54104c commit e5ad24f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

netlify.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@
6161
[headers.values]
6262
Cache-Control = "no-store, no-cache, must-revalidate"
6363

64-
# Development/Preview context overrides
64+
# Preview context - clear cache to avoid stale artifacts
6565
[context.deploy-preview]
66-
command = "npm ci && npm run build"
66+
command = "rm -rf .next && npm ci && npm run build"
6767
[context.deploy-preview.environment]
68-
NODE_ENV = "development"
68+
NODE_ENV = "production"
6969

7070
[context.branch-deploy]
71-
command = "npm ci && npm run build"
71+
command = "rm -rf .next && npm ci && npm run build"
7272
[context.branch-deploy.environment]
73-
NODE_ENV = "development"
73+
NODE_ENV = "production"
7474

75-
# Production context
75+
# Production context - clear cache to avoid stale artifacts
7676
[context.production]
77-
command = "npm ci && npm run build"
77+
command = "rm -rf .next && npm ci && npm run build"
7878
[context.production.environment]
7979
NODE_ENV = "production"
8080

0 commit comments

Comments
 (0)