Ignored folders as page on /pages folder
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
It isn’t related to a problem. But if what I’m asking already exists its a good idea to let it more clear on the docs.
Describe the solution you’d like
It will be awesome if we can add a config on next.config that allow us to add a ignored name folder to /pages that will not crawl that folder as an app page.
The purpose of it is a way to create a components folder wich has the components that belong to a unique page and (probably) wont be reused again. That kind of practice let clear that this components belong only to that page and will be easier to add things like useMemo, React.memo and useCallback without pollute the root /components folder with never reused components.
Something like:
Folder:
/pages
.... /customers
........ /components
........ index.js
Config:
module.exports = {
notPage: ['components']
};
Describe alternatives you’ve considered
It is possible to create a /pages components inside root /components folder and there add that kind of component.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:15
- Comments:8 (2 by maintainers)

Top Related StackOverflow Question
This has been discussed many times before in the issue tracker. Most recently the issue below.
Duplicate of https://github.com/zeit/next.js/issues/8454
You can get around this easily by just using the
/pagesfolder as an index of files that point to a separate/pages-libfolder, structured however you want. eg. each file is just a single lineexport { default } from 'page-lib/Index'