diff --git a/app-webpack/templates/entry/client-prefetch.js b/app-webpack/templates/entry/client-prefetch.js index 765970dda74..33648edc2b8 100644 --- a/app-webpack/templates/entry/client-prefetch.js +++ b/app-webpack/templates/entry/client-prefetch.js @@ -32,7 +32,11 @@ function getMatchedComponents (to, router) { if (!route) { return [] } - return Array.prototype.concat.apply([], route.matched.map(m => { + const matched = route.matched.filter(m => m.components !== void 0) + + if (matched.length === 0) { return [] } + + return Array.prototype.concat.apply([], matched.map(m => { return Object.keys(m.components).map(key => { const comp = m.components[key] return { diff --git a/app-webpack/templates/entry/server-entry.js b/app-webpack/templates/entry/server-entry.js index 3d008fff3cc..3329450ad53 100644 --- a/app-webpack/templates/entry/server-entry.js +++ b/app-webpack/templates/entry/server-entry.js @@ -138,6 +138,7 @@ export default ssrContext => { // wait until router has resolved possible async hooks router.isReady().then(() => { let matchedComponents = router.currentRoute.value.matched + .filter(record => record.components !== void 0) .flatMap(record => Object.values(record.components)) // no matched routes