Add pagesDir config option
See original GitHub issueRelating to https://github.com/zeit/next.js/issues/875, willing to try a PR if offered guidance.
We’re building a ecommerce store from scratch with next and are close to finishing the initial architecture. The only thing bugging us is the number of folders we ended up with. The src
folder would be a major improvement in our structure and the way we thought it could be done is by adding a property called pagesDir
in the next.config.js
configuration.
With this new options set to something like:
{
"pagesDir": './src/pages'
}
we could keep all the source code in src, including the pages.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Added description at the top of the page
Current Behavior
Pages cannot be placed within a sub folder.
Steps to Reproduce (for bugs)
Context
Your Environment
Tech | Version |
---|---|
next | 6.0.0 |
node | 6.x |
OS | N/A |
browser | N/A |
etc |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:28
- Comments:32 (16 by maintainers)
Top Results From Across the Web
Advanced Features: `src` Directory - Next.js
Pages can also be added under src/pages as an alternative to the root pages ... pages is present in the root directory; Config...
Read more >vite-plugin-pages - npm
Specifying an array of PageDirOptions for pagesDir allow you to store pages anywhere in the source you'd like, and specify the base route...
Read more >git-config Documentation - Git
Multiple lines can be added to an option by using the --add option. If you want to update or unset an option which...
Read more >Your First Higher-Order Next.js Config: Generating a Sitemap ...
So, create a config/withSitemap.js file under your project and add the ... While we are there, we can also add an option to...
Read more >Custom Build Output Directory - Qwik - Builder.io
vite.config.js import { defineConfig } from 'vite'; import { qwikVite } from ... to `dist` by qwikVite() setting }, plugins: [ qwikCity({ pagesDir, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to be clear I’m strongly against any config value for this, we’ve seen tons of misusage of config values like these (looking at
distDir
for example). The thing I’m willing to consider is addingsrc/pages
support, where you choose either root level pages directory orsrc/pages
, as apparently this covers the majority use-case of why people are asking for this feature.We are not planning to allow changing the
pages
directory.However a solution for #4406 should be explored. Let’s track that in https://github.com/zeit/next.js/issues/3027