Back to TIL
March 2026
posted on 03.30.2026

Next.js force-static Pages Require Dev Server Restart

Pages with export const dynamic = 'force-static' and export const revalidate = false are fully pre-rendered at build time via generateStaticParams(). In development mode, this means:

  • New MDX files added to a content directory are not picked up by hot reload.
  • New database entries are not reflected until the dev server restarts.
  • Changes to existing MDX files may or may not trigger recompilation depending on webpack's file watcher.
export const dynamic = 'force-static'
export const revalidate = false

export async function generateStaticParams() {
  // This runs ONCE at server start in dev mode
  const posts = getContentByType("news")
  return posts.map(p => ({ slug: p.slug }))
}

The generateStaticParams() function executes once when the dev server starts. Adding a new row to the database or a new .mdx file does not re-trigger it.

To see new content in dev: kill the server (fuser -k 3000/tcp), remove the lock file if needed (rm .next/dev/lock), and restart. There is no hot-reload workaround without changing the page to force-dynamic (which sacrifices static generation).

In production builds (npm run build), this is not an issue because generateStaticParams() runs during the build and all pages are pre-rendered at that point.

No reactions yet

in Naperville, IL
Last visitor from Mitaka, Japan
⌘K