chrisvfritz / prerender-spa-plugin

Prerenders static HTML in a single-page application.
MIT License
7.32k stars 634 forks source link

"/" page flashing before routes load #473

Closed pieroliviermarquis closed 3 years ago

pieroliviermarquis commented 3 years ago

The default home page is flashing for a few milliseconds before the target routes load.

I am using Vue 2 with Router.

Not only is it not pleasing, but the crawlers also just read the content of the "/" page before the target routes load, making it useless for SEO.

module.exports = { chainWebpack: config => { config.module.rules.delete("eslint"); }, configureWebpack: { plugins: process.env.NODE_ENV === "production" ? [ new PrerenderSPAPlugin({ // Required - The path to the webpack-outputted app to prerender. staticDir: path.join(__dirname, "dist"), // Required - Routes to render. routes: [ "/", "/contact", "/features", ], renderer: new Renderer({ headless: true, args: ["--no-sandbox", "--disable-setuid-sandbox"], renderAfterDocumentEvent: "render-event" }) }) ] : [] } };