Skip to content

Instantly share code, notes, and snippets.

View AlonsoMackenlly's full-sized avatar
🗻
A happy life begins with peace of mind.

AlonsoMackenlly AlonsoMackenlly

🗻
A happy life begins with peace of mind.
View GitHub Profile
@m-ripper
m-ripper / README.md
Last active July 6, 2024 13:59
Custom Next pages directory

Custom Next pages directory

Next.js has a limited set of possible pages-directories, either pages or src/pages. This is not going to change in the future, as mentioned here.

In some cases it is necessary or helpful to have a custom pages-directory.

These two snippets make it possible:

patch-custom-next-pages-dir.js

Monkey-patches findPagesDir inside of next to check for the custom pages-directory at RELATIVE_CUSTOM_PAGES_PATH.