Next.js Discord

Discord Forum

NextJS CSR with dynamic routes (app router)

Unanswered
Chinese Alligator posted this in #help-forum
Open in Discord
Chinese AlligatorOP
Hi everyone,

I’m trying to deploy a client-side rendered (CSR) Next.js app as a static SPA (HTML/CSS/JS) using output: 'export', but I’m hitting a snag with dynamic routes.

Goal:
Make /(private)/blog/[id]/view/ work in a fully static export. The [id] is user-generated, so I can’t pre-render paths with generateStaticParams().

Problem:
When I add this to next.config.js:
output: 'export',
distDir: './dist',

The build fails with:
Error: Page "/(private)/blog/[id]/view" is missing "generateStaticParams()" so it cannot be used with "output: export" config.


What I’ve tried:
- Disabling SSG/SSR (since this is CSR-only).
- Searching for repos/examples using output: 'export' with dynamic routes—no luck.

Question:
Is there a workaround to export dynamic routes as static files without generateStaticParams()? Or are there known repos demonstrating this setup?

FYI: im using app router, not page router.

Thanks for any pointers!

1 Reply

Chinese AlligatorOP
hi everyone. Seems NextJS app router does not support creating SPAs with dynamic routes.

need to switch to page-router or other methods.