-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When using export const dynamic = 'force-static' in a Next.js page (e.g., inside a page.tsx or page.js file within the app directory), the page does not behave as expected. It does not enforce static generation and still behaves as if it's dynamic.
Reproduction :
-
Create a new route under app/page.tsx.
-
Add the following:
export const dynamic = 'force-static';
export default function Page() {
console.log("Running on server");
return <div>Hello from static</div>;
}
- Run next build && next start or next dev
Expected Behaviour
The page should be statically generated at build time (similar to using getStaticProps in the old pages router) and not include any dynamic logic or server rendering at runtime.
Actual Behaviour
redirect to 404 pages and have an error message below
Unable to find `next-intl` locale because the middleware didn't run on this request and no `locale` was returned in `getRequestConfig`. See https://next-intl.dev/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.