[Error: TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded]
MuYunyun opened this issue · 1 comments
MuYunyun commented
MuYunyun commented
经定位、查找 pptr 官网文档
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: docsBuildDist,
outputDir: docsConfig.repo ? `${docsBuildDist}/${docsConfig.repo}` : docsBuildDist,
indexPath: docsConfig.repo ? `${docsBuildDist}/${docsConfig.repo}/index.html` : `${docsBuildDist}/index.html`,
// Required - Routes to render.
routes,
successCb: async () => {
if (docsConfig.repo) {
// not use fs.move here or it'll throw error in github action
await fs.copy(`${docsBuildDist}/${docsConfig.repo}`, docsBuildDist)
await fs.remove(`${docsBuildDist}/${docsConfig.repo}`)
// move README as root index.html
await fs.copy(`${docsBuildDist}/README/index.html`, `${docsBuildDist}/index.html`)
console.log('generate prerender file success!')
if (docsConfig.seo) {
if (docsConfig.seo.google) {
fs.writeFileSync(`${docsBuildDist}/sitemap.xml`, generateSiteMap(routes))
}
}
console.log('generate sitemap file success!')
}
},
// The actual renderer to use. (Feel free to write your own)
// Available renderers: https://github.com/Tribex/prerenderer/tree/master/renderers
renderer: new Renderer({
// Optional - The name of the property to add to the window object with the contents of `inject`.
injectProperty: '__PRERENDER_INJECTED',
// Optional - Any values you'd like your app to have access to via `window.injectProperty`.
inject: {
prerender: true,
},
// Optional - defaults to 0, no limit.
// Routes are rendered asynchronously.
// Use this to limit the number of routes rendered in parallel.
maxConcurrentRoutes: 4,
+ // https://pptr.dev/#?product=Puppeteer&version=v5.5.0&show=api-pagegotourl-options
+ navigationOptions: {
+ timeout: 0
+ }
}),
}),尝试在 pptr 的 goto 方法上传入 timeout: 0 属性。


