Next.js Discord

Discord Forum

How to use index.js instead of page.js?

Answered
Daggertooth pike conger posted this in #help-forum
Open in Discord
Daggertooth pike congerOP
How can I configure Next to load index.js files instead of page.js files?
As I'm trying to upgrade an existing project, I would prefer a solution that doesn't require me to change many files. (The project heavily relies on index.js files being routed to their containing directory.)

I'm also wondering why the default file name was changed from 'index.js' in the first place.
Answered by joulev
No, that’s impossible
View full answer

3 Replies

No, that’s impossible
Answer
The reason for the change was that while the pages router used both the folder path and the file name to determine the route, the app router only uses exclusively the folder path. The file name is used to indicate the type of the file
Redwing
impossible