Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add next.config.js validation with ajv #38498

Merged
merged 12 commits into from
Jul 13, 2022
24 changes: 24 additions & 0 deletions errors/invalid-next-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.

#### 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.
ijjk marked this conversation as resolved.
Show resolved Hide resolved

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

module.exports = nextConfig
```

### Useful Links

- [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction)
4 changes: 4 additions & 0 deletions errors/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,10 @@
{
"title": "node-module-in-edge-runtime",
"path": "/errors/node-module-in-edge-runtime.md"
},
{
"title": "invalid-next-config",
"path": "/errors/invalid-next-config.md"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="./types/global" />
/// <reference path="./dist/styled-jsx-types/global.d.ts" />
/// <reference path="./amp.d.ts" />
/// <reference path="./app.d.ts" />
/// <reference path="./config.d.ts" />
Expand All @@ -11,7 +12,6 @@
/// <reference path="./router.d.ts" />
/// <reference path="./script.d.ts" />
/// <reference path="./server.d.ts" />
/// <reference path="./dist/styled-jsx-types/global" />

export { default } from './types'
export * from './types'
2 changes: 2 additions & 0 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"index.d.ts",
"types/index.d.ts",
"types/global.d.ts",
"types/compiled.d.ts",
"image-types/global.d.ts"
],
"bin": {
Expand Down Expand Up @@ -168,6 +169,7 @@
"@vercel/ncc": "0.33.4",
"@vercel/nft": "0.20.0",
"acorn": "8.5.0",
"ajv": "8.11.0",
"amphtml-validator": "1.0.35",
"arg": "4.1.0",
"assert": "2.0.0",
Expand Down
Loading