Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Unable to prerender all routes! #196

Closed
484sha opened this issue May 16, 2018 · 6 comments
Closed

Unable to prerender all routes! #196

484sha opened this issue May 16, 2018 · 6 comments

Comments

@484sha
Copy link

484sha commented May 16, 2018

Hi, I have a trouble in using prerender-spa-plugin in my vue project with vue2.0 + vue-router.

This is my webpack.prod.conf.js:
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, '../dist'),
routes: ['/home/homePage'],
})

This is my /router/index.js:
export default new Router({
mode: 'history',
linkActiveClass: 'is-active',
routes: [
{ path: '/', redirect: '/home/layout' },
...Home
]
})

This is my router under layout:
export default {
name: 'home.layout',
path: '/home/layout',
component: r => require.ensure([], () => r(require('src/modules/home/layout/page/index.vue')), 'HomeLayout'),
redirect: '/home/homePage',
children: [
homePage
]
};

My homePage is under layout.When I build:
building for production...[prerender-spa-plugin] Unable to prerender all routes!
(node:6184) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Navigation Timeout Exceeded: 30000ms exceeded

Can you help me?Thanks

@JoshTheDerf
Copy link
Collaborator

Looks like you need to configure your renderer. You haven't set any triggers for it to render on.
This one will render after five seconds.

new PrerenderSPAPlugin({
  staticDir: path.join(__dirname, '../dist'),
  routes: ['/home/homePage'],
  renderer: new PrerenderSPAPlugin.PuppeteerRenderer({
    renderAfterTime: 5000
  })
})

@484sha
Copy link
Author

484sha commented May 22, 2018

Thanks a lot.I have been resolved the problem.

@484sha 484sha closed this as completed May 22, 2018
@katoto
Copy link

katoto commented Jul 18, 2018

how to ?

@484sha
Copy link
Author

484sha commented Aug 27, 2018

@katoto You can use renderAfterTime

@lzh15378738622
Copy link

maybe my project run build it's suceess, but whatever the config routes is, the build result has only one dir in dist !

@lzh15378738622
Copy link

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants