rsnext/errors/invalid-next-config.md
JJ Kasper 8b4d9e652e
Add more details to invalid-next-config doc (#42917)
This adds some more clarity to the error doc and we can also iterate on
the warnings to show suggestions as well in follow-ups.

x-ref: [slack
thread](https://vercel.slack.com/archives/CHZGRCJSD/p1668430036939189?thread_ts=1668394104.483679&cid=CHZGRCJSD)

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-14 13:59:59 -08:00

934 B

Invalid next.config.js

Why This Error Occurred

In your next.config.js file you passed invalid options that either are the incorrect type or an unknown field. This warning is shown to help catch typos that cause expected configs to not be applied.

Possible Ways to Fix It

Fixing the listed config errors will remove this warning. You can also leverage the NextConfig type by importing from next to help ensure your config is correct.

/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  /* config options here */
}

module.exports = nextConfig

For example for the below warning, there is a typo and rewritess needs to be renamed to rewrites to resolve the issue.

The root value has an unexpected property, rewritess, which is not in the list of allowed properties