Skip to content

Instantly share code, notes, and snippets.

View m-ripper's full-sized avatar

Max Ripper m-ripper

  • AMPEERS Energy
  • Berlin, Germany
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.