Skip to content

Commit

Permalink
fix: Prevent error when using extendRoutes
Browse files Browse the repository at this point in the history
This reapplies fix from v2.9.1 which fixes *TypeError: Cannot read property 'replace' of undefined*
when `extendRoutes` is defined in Nuxt's config

Fixes #52
  • Loading branch information
paulgv committed Aug 9, 2018
1 parent 61534d4 commit 1509a71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getPageOptions = (route, pages, locales, pagesDir) => {
paths: {}
}
const pattern = new RegExp(`${pagesDir}/`, 'i')
const chunkName = route.chunkName.replace(pattern, '')
const chunkName = route.chunkName ? route.chunkName.replace(pattern, '') : route.name
const pageOptions = pages[chunkName]
// Routing disabled
if (pageOptions === false) {
Expand Down

0 comments on commit 1509a71

Please sign in to comment.