i am having issues in making build with dynamic routes i use clerk for authentication and it has dynamic routes i.e app/sign-in/[[…sign-in]].page.tsx and app/sign-up/[[…sign-up]].page.tsx and i have static routes also i.e /dashboard , /dashboard/add-a-prospect so in my next config file i use export output but it only use for static file generation.
I also use generateStaticParams and dynamic but the issue is not solved.
Hi, @akshatbisht!
The file structure you mentioned (app/sign-in/[[…sign-in]].page.tsx
) is not correct for the App Router. In the App Router, it should be app/sign-in/[[...sign-in]]/page.tsx
. Could you make these edits?
The use of generateStaticParams
is correct, but its implementation differs slightly in the App Router. For static routes, generateStaticParams
is used at the page level, not in the config:
// app/dashboard/page.tsx
export function generateStaticParams() {
return [
{ slug: [] },
{ slug: ['add-a-prospect'] },
]
}
The dynamic
export is correct, but its usage has some nuances in the App Router.
The output: 'export'
should be removed in your next.config.js
.
Let us know how you get on!
Thank You for your response i’ll do this changes.
But still when i deploy it in server i need that out folder like for example my site is www.abc.com/demo now i have to replace that /demo with the output folder but if i do not create any output folder then how i can replace it?
Could you share a minimal reproducible example for us to dig deeper?