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! 100 routes #432

Open
carljustineoyales opened this issue Mar 9, 2021 · 2 comments
Open

Unable to prerender all routes! 100 routes #432

carljustineoyales opened this issue Mar 9, 2021 · 2 comments

Comments

@carljustineoyales
Copy link

i have a vue project the gets blogpost from a headless cms. the problem there is over 100+ blogpost on that cms. prerendering it gave me this error

[prerender-spa-plugin] Unable to prerender all routes!
module.exports = (api, options) => {
	api.registerCommand("build:prerender", async (args) => {
		const { data } = await axios({
			method: "get",
			url: "https://projectname.microcms.io/api/v1/portfolio?limit=999",
			headers: {
				"X-API-KEY": "X-API-KEY",
			},
		});

		api.chainWebpack((config) => {
			config.plugin("prerender").use(PrerenderSPAPlugin, [
				{
					// Required - The path to the webpack-outputted app to prerender.
					staticDir: path.join(__dirname, "dist"),
					// Required - Routes to render.
					routes: ["/"].concat(
						data.contents.map((post) => {
							return `/post/${post.id}`;
						})
					),
					renderer: new Renderer({
						injectProperty: "__PRERENDER_INJECTED",
						inject: {
							prerendered: true,
						},
						renderAfterElementExists: "[ready]",
						headless: true,
						ignoreHTTPSErrors: true,
						maxConcurrentRoutes: 4,
					}),
				},
			]);
		});

		await api.service.run("build", args);
	});
};

can anyone help me? i tried changing the maxConcurrentRoutes and still gives me that error

@ericuldall
Copy link

Getting the same [prerender-spa-plugin] Unable to prerender all routes! Surely this "error" is some sort of cruel joke.

@Tofandel
Copy link

Tofandel commented Apr 2, 2022

Duplicate of #414, it is not compatible with webpack 5

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

3 participants