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.

Ignored folders as page on /pages folder

See original GitHub issue

Feature request

Is your feature request related to a problem? Please describe.

It isn’t related to a problem. But if what I’m asking already exists its a good idea to let it more clear on the docs.

Describe the solution you’d like

It will be awesome if we can add a config on next.config that allow us to add a ignored name folder to /pages that will not crawl that folder as an app page. The purpose of it is a way to create a components folder wich has the components that belong to a unique page and (probably) wont be reused again. That kind of practice let clear that this components belong only to that page and will be easier to add things like useMemo, React.memo and useCallback without pollute the root /components folder with never reused components.

Something like:

Folder:

/pages
....  /customers
........  /components
........  index.js

Config:

module.exports = {
    notPage: ['components']
};

Describe alternatives you’ve considered

It is possible to create a /pages components inside root /components folder and there add that kind of component.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
timneutkenscommented, Feb 1, 2020

This has been discussed many times before in the issue tracker. Most recently the issue below.

Duplicate of https://github.com/zeit/next.js/issues/8454

13reactions
pcmaffeycommented, Mar 20, 2020

You can get around this easily by just using the /pages folder as an index of files that point to a separate /pages-lib folder, structured however you want. eg. each file is just a single line export { default } from 'page-lib/Index'

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom _app and _document get ignored when moving files ...
tsx files, get ignored when the pages folder is moved into src. You can recreate this issue yourself, when creating an empty Next.js...
Read more >
Ignoring files, folders, or code - Semgrep
To ignore files or folders for a particular scan. Run Semgrep with the flag --exclude followed by the pattern or file to be...
Read more >
gitignore Documentation - Git
Each line in a gitignore file specifies a pattern. When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple...
Read more >
Ignoring Code - Prettier
Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
Read more >
.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found