Next.js Discord

Discord Forum

`export const dynamicParams = false` is not working with `output: 'export'`

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I have a static documentation site with 3 dynamic segments:
- app/[locale]
- app/[locale]/[project]
- app/[locale]/[project]/[...docPath]

Each route segment has it own generateStaticParams to handle static page generation at build time. This all works fine, but when I try to visit route segment that hasn't been generated by generateStaticParams, e.g: http://localhost:3000/english it should redirect me to a 404 page when setting export const dynamicParams = false on the dynamic segment page or layout as it is said here: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams , but it's not working on Next.js 14.0.3

How can I redirect to a 404 page or show message or something when the user tries to visit non-existent page (route segment that hasn't been generated by generateStaticParams at build time) ?

Note:
- I have a custom not-found.tsx file in each dynamic segment and in the main app segment.
- I have set export const dynamicParams = false in each dynamic page/layout
- I'm using output: 'export'
- I'm using Next.js 14.0.3

0 Replies