-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignored folders as page on /pages folder #10377
Comments
This has been discussed many times before in the issue tracker. Most recently the issue below. Duplicate of #8454 |
I think this should be considered deeply. I do understand the concerns and one of the biggest advantages of next.js is the convention over configuration... The thing I don't understand is why not make the in the project I'm working on we are actually implementing the separation of concerns in a mirrored folder solution, but to actually being able to do that our scaffolding is getting pretty tedious to navigate, pretty fast... This is how we are actually implementing the separation of concerns while respecting the current routing convention
to make this feasible at all we had to develop a dedicated I don't see how this convention could be the preferred way to do the routing over actually making the user explicitly expose files by using the .pages.[ext] pattern If anything I think the thing that is more error prone is exposing everything under pages... ( coming from someone that started with Create React App and implemented the custom routing with the SPA approach and ReactRouter ). Also the It was quite a shock to me that ANYTHING under the I would rather give a "double confirmation" by having to not only use the |
You can get around this easily by just using the |
Despite solving, this will prevent using Data fetching methods on server side: |
This is easily solved by adding the required function to the same line: |
For people that's searching for a way to ignore files inside |
I can use files, but as I understand correctly, the directories are still crawled for pages. I have this error: Isn't it possible to discard as path a whole directory at once with some prefix? |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Feature 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:
Config:
Describe alternatives you've considered
It is possible to create a
/pages
components insideroot
/components
folder and there add that kind of component.The text was updated successfully, but these errors were encountered: