40abd708e1
* Show better error when non-array is returned from custom-routes * bump Co-authored-by: Joe Haddad <timer150@gmail.com>
42 lines
682 B
Markdown
42 lines
682 B
Markdown
# Custom Routes must return an array
|
|
|
|
#### Why This Error Occurred
|
|
|
|
When defining custom routes an array wasn't returned from either `headers`, `rewrites`, or `redirects`.
|
|
|
|
#### Possible Ways to Fix It
|
|
|
|
Make sure to return an array that contains the routes.
|
|
|
|
**Before**
|
|
|
|
```js
|
|
// next.config.js
|
|
module.exports = {
|
|
experimental: {
|
|
async rewrites() {
|
|
return {
|
|
source: '/feedback',
|
|
destination: '/feedback/general',
|
|
}
|
|
},
|
|
},
|
|
}
|
|
```
|
|
|
|
**After**
|
|
|
|
```js
|
|
module.exports = {
|
|
experimental: {
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/feedback',
|
|
destination: '/feedback/general',
|
|
},
|
|
]
|
|
},
|
|
},
|
|
}
|
|
```
|