prerender-spa-plugin icon indicating copy to clipboard operation
prerender-spa-plugin copied to clipboard

How to pre-render Dynamic Routes?

Open ottz0 opened this issue 5 years ago • 2 comments

I have Dynamic routes that are setup as I need to get products from an API. How can I configure the prerenderer to work with dynamic routes

/product/:id

ottz0 avatar Mar 17 '20 01:03 ottz0

I think you have to use SSR if you want to pre-render automatically all the dynamic routes. If you want to use this plugin you have to add all the routes in the vue.config.js.

alexauvray avatar Apr 15 '20 22:04 alexauvray

Regardless of the frontend framework, you need to explicitly provide the routes in the plugin configuration. If you have dynamic routes, you could fetch the routes from your API before providing them to the config. In webpack you can return the config as a promise. If you are using Vue, the configureWebpack option doesn't yet support promises, so you can use the solution provided in this thread meanwhile.

#412

valentinoli avatar Nov 06 '20 10:11 valentinoli