question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add pagesDir config option

See original GitHub issue

Relating 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:closed
  • Created 5 years ago
  • Reactions:28
  • Comments:32 (16 by maintainers)

github_iconTop GitHub Comments

64reactions
timneutkenscommented, Aug 17, 2019

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 adding src/pages support, where you choose either root level pages directory or src/pages, as apparently this covers the majority use-case of why people are asking for this feature.

37reactions
timneutkenscommented, Dec 31, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found