You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support locating non page files like test files with page files in pages folder
Ignore or hide test api routes form users
Background
Well the current way of doing it is by using page extensions that means every page or route in the page's directory has to have a .page.tsx or .api.ts extension and the other non build files will have there normal extensions like .test.ts or .dev.ts and this is inputted as an array in the pageExtension property in the next.config.js file. As you can imagen for a large project this can be tedious for a such a simple task. There are also other way's like using a webpack loader like ignore-loader but they don't fully work. So to conclude I believe that this feature will increase developer experience by letting them use the conventions they are accustomed to and have grown to expect.
Proposal
My proposal is simple there should be a property in the next.config.js that will allow developers to exclude file with specific extensions like .test.ts or .dev.ts which is basically the opposite of what pageExtension does and by doing this next.js will be able to differentiate between files that should be compiled for production and files that shouldn't.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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
Background
Well the current way of doing it is by using page extensions that means every page or route in the page's directory has to have a .page.tsx or .api.ts extension and the other non build files will have there normal extensions like .test.ts or .dev.ts and this is inputted as an array in the pageExtension property in the next.config.js file. As you can imagen for a large project this can be tedious for a such a simple task. There are also other way's like using a webpack loader like ignore-loader but they don't fully work. So to conclude I believe that this feature will increase developer experience by letting them use the conventions they are accustomed to and have grown to expect.
Proposal
My proposal is simple there should be a property in the next.config.js that will allow developers to exclude file with specific extensions like .test.ts or .dev.ts which is basically the opposite of what pageExtension does and by doing this next.js will be able to differentiate between files that should be compiled for production and files that shouldn't.
Beta Was this translation helpful? Give feedback.
All reactions