How can i change NextJS pages folder

Viewed 69

Refer to NextJS document, NextJS read the /pages folder as default router. Can I force NextJS to read another folder instead?

For my case, it will be great if i can define the router by merging 2 folders.

2 Answers

Unfortunately, it seems Next.js officially supports only ./pages or ./src/pages directories.

For whole is still have problem with this, i found out a possible approach is handling customized router logic in a /pages/[...all].js file

Related