diff --git a/app/templates/entry/client-prefetch.js b/app/templates/entry/client-prefetch.js index aaf053040a1..d31f5bc86e0 100644 --- a/app/templates/entry/client-prefetch.js +++ b/app/templates/entry/client-prefetch.js @@ -30,7 +30,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/templates/entry/server-entry.js b/app/templates/entry/server-entry.js index d52f4d81811..39cb86714d2 100644 --- a/app/templates/entry/server-entry.js +++ b/app/templates/entry/server-entry.js @@ -123,6 +123,7 @@ export default context => { // wait until router has resolved possible async hooks router.onReady(() => { const matchedComponents = router.getMatchedComponents() + .filter(m => m !== void 0) .map(m => m.options /* Vue.extend() */ || m) // no matched routes