Customizable File Naming Conventions via Regex in Next.js #58389
LotfiMEZIANI
started this conversation in
Ideas
Replies: 1 comment
-
+1. I want to manage my naming conventions like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
In large-scale projects, the default file naming conventions in Next.js can limit the developer's ability to organize and quickly understand project structures. While Next.js follows convention over configuration, offering a way to customize file naming via regex in
next.config.js
could provide enhanced flexibility without sacrificing the framework's principles.Proposal
I propose that Next.js introduces a feature in
next.config.js
that allows developers to define their own regex patterns for naming special files likepage.js
orlayout.js
. For example, developers could specify that any file ending with.page.tsx
be treated as a page component.Here's a potential configuration snippet:
This feature would be optional and fully backward compatible, with the current naming conventions remaining as the default.
Beta Was this translation helpful? Give feedback.
All reactions