rsnext/errors/invalid-page-config.md
Kevin Mårtensson aa4b87e357
Handle cases where config is exported after its declaration (#16211)
AMP will still not work correctly when switching between non-AMP and AMP pages in development mode because of https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/plugins/next-page-config.ts#L116-L120.

Fixes #15704.
2020-08-17 17:24:18 +00:00

39 lines
716 B
Markdown

# Invalid Page Config
#### Why This Error Occurred
In one of your pages you did `export const config` with an invalid value.
#### Possible Ways to Fix It
The page's config must be an object initialized directly when being exported and not modified dynamically.
This is not allowed
```js
export const config = 'hello world'
```
This is not allowed
```js
const config = {}
config.amp = true
```
This is not allowed
```js
export { config } from '../config'
```
This is allowed
```js
export const config = { amp: true }
```
### Useful Links
- [Enabling AMP Support](https://nextjs.org/docs/advanced-features/amp-support/introduction)
- [API Middlewares](https://nextjs.org/docs/api-routes/api-middlewares)