rsnext/errors/export-path-mismatch.md
Lukáš Huvar 2450c85e81 exportPathMap dynamic routes params fix (#7846)
* Fix dynamic page export fixes #7829

* Adding handling of unmatched path

* Remove logs

* Fix newline

* Tests

* Fix promise

* Fix amp tests

* Revert test

* Adjust error document

* Remove old argument

* Simplify export test

* Ensure page !== path for this check
2019-07-10 17:13:44 -04:00

26 lines
726 B
Markdown

# The provided export path doesn't match the page.
#### Why This Error Occurred
An `exportPathMap` path was improperly matched to a dynamically routed page.
This would result in the page missing its URL parameters.
#### Possible Ways to Fix It
Change your `exportPathMap` function in `next.config.js` to have a path that matches the dynamically routed page.
```js
module.exports = {
exportPathMap: function() {
return {
'/': { page: '/' },
// '/blog/nextjs': { page: '/blog/[post]/comment/[id]' }, // wrong
'/blog/nextjs/comment/1': { page: '/blog/[post]/comment/[id]' }, // correct
}
},
}
```
### Useful Links
- [exportPathMap](https://github.com/zeit/next.js#usage) documentation