I want this feature too but the only solution that simple and works is this:
export async function generateStaticParams() {
if (process.env.MODULE != '') {
return [{ slug: [] }]
}
return source.generateParams()
}
then:
MODULE=rpa pnpm run build
the out build would not include the dynamic route directory.
next version: ^14.2.15