Open nkHub opened 3 years ago
I install mkdirp package and change index.js the directory of es6 for replace the function mkdirp,after that it works.
I install mkdirp package and change index.js the directory of es6 for replace the function mkdirp,after that it works.
Same problem, could you please write more details about the solution?
I got the same isuue
github:RoboFinance/prerender-spa-plugin#4.0.0
If no network,you must make sure that there is chromium (/node_modules/puppteer/.local-chromium)
Next, you can add console.log('err', err)
in catch (/node_modules/prerender-spa-plugin/es6/index.js),you will find details.
// node_modules/prerender-spa-plugin/es6/index.js
...
.catch(err => {
console.log('err', err) // Add this to find the error at line 144
PrerendererInstance.destroy()
const msg = '[prerender-spa-plugin] Unable to prerender all routes!'
console.error(msg)
compilation.errors.push(new Error(msg))
done()
})
If your error is Navigation Timeout Exceeded: 30000ms exceeded
, the following need to be modified:
// node_modules/@prerenderer/renderer-puppeteer/es6/renderer.js
const navigationOptions = (options.navigationOptions) ? { waituntil: 'networkidle0', ...options.navigationOptions } : { waituntil: 'networkidle0' };
await page.goto(`${baseURL}${route}`, navigationOptions);
modify to
await page.goto(`${baseURL}${route}`, {...navigationOptions, timeout: 0});
https://stackoverflow.com/questions/52163547/node-js-puppeteer-how-to-set-navigation-timeout
In webpack, add navigationOptions: { timeout: 0}
const PrerenderSpaPlugin = require("prerender-spa-plugin");
const Renderer = PrerenderSpaPlugin.PuppeteerRenderer
new PrerenderSpaPlugin({
routes: ['/', '/contact'],
renderer: new Renderer({
navigationOptions: {
timeout: 0
}
})
}),
Duplicate of https://github.com/chrisvfritz/prerender-spa-plugin/issues/414, not compatible with webpack 5
es6/index.js in webpack5 compilerFS.mkdirp is undefined.