Skip to content

Commit

Permalink
docs: Add link to pageExtensions config in page-without-valid-compone…
Browse files Browse the repository at this point in the history
…nt.md

The [Page Without Valid React Component](https://nextjs.org/docs/messages/page-without-valid-component) explains some ways to fix the problem of Next finding a non-React Component. However, if someone is trying to use `.mdx` as an extension, or wants to include tests, stories or other non-page files in their `pages` folder there's nothing for them.

The [Custom Page Extensions](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions) has all the info to help them out, but adding it to this error page should make it more discoverable.
  • Loading branch information
benmvp committed Feb 13, 2022
1 parent 069e61d commit de4adaa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions errors/page-without-valid-component.md
Expand Up @@ -14,3 +14,5 @@ For each, you'll want to check if the file is meant to be a page.
If the file is not meant to be a page, and instead, is a shared component or file, move the file to a different folder like `components` or `lib`.

If the file is meant to be a page, double check you have an `export default` with the React Component instead of an `export`. If you're already using `export default`, make sure the returned value is a valid React Component.

If you need to support a different file extension for a page component (such as `.mdx`) or would like to include non-page files in the `pages` directory, configure [Custom Page Extensions](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions) in the `next.config.js`.

0 comments on commit de4adaa

Please sign in to comment.