Skip to content

Commit 1509a71

Browse files
committed
fix: Prevent error when using extendRoutes
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
1 parent 61534d4 commit 1509a71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const getPageOptions = (route, pages, locales, pagesDir) => {
3535
paths: {}
3636
}
3737
const pattern = new RegExp(`${pagesDir}/`, 'i')
38-
const chunkName = route.chunkName.replace(pattern, '')
38+
const chunkName = route.chunkName ? route.chunkName.replace(pattern, '') : route.name
3939
const pageOptions = pages[chunkName]
4040
// Routing disabled
4141
if (pageOptions === false) {

0 commit comments

Comments
 (0)