I'm trying to configure prerender-spa-plugin
to work with my vue.js (1.x) application. When I build an application without it - everything works perfectly, but I need to get pages pre rendered foe SEO purposes.
When I install the plugin, it does prerender, but then it shows me some router error ([vue-router] Uncought error during transition
) and also TypeError: undefined is not an object (evaluating 's(e).isEqualNode')
.
Again - none of this errors happen if I build the app for production without pretender-spa-plugin
.
Some info about the tools:
- Mac OS
- node v6.10.1
- quasar --version 0.5.2 (project runs using quasar framework)
- npm -v3.10.10
- vue.js (1.x)
Then, relevant settings are:
webpack.prod.conf.js
module.exports = {
plugins: [
new PrerenderSpaPlugin(
// Absolute path to compiled SPA
path.join(__dirname, '../dist'),
// List of routes to prerender
[ '/', '/apps'],
{
captureAfterDocumentEvent: 'custom-post-render-event',
captureAfterTime: 2000,
ignoreJSErrors: false,
captureAfterElementExists: '.main',
}
)
]
div .main
actually exists within every component which I need to prerender
main.js
document.addEventListener('DOMContentLoaded', function () {
Quasar.start(() => {
Router.start(App, '#quasar-app')
})
document.dispatchEvent(new Event('custom-post-render-event'))
})
app.vue
module.exports = {
replace: false,
....
What I've already tried:
Not to use some of these triggers, which I've written here foe webpack. I guess I've already tried all possible combinations - sometimes build process just hangs up, sometimes - it is compiled with the same problem.
I tried to set this custom even in my initial app.vue file, and attach it to
ready ()
- the same resultI tried to specify
replace: false
to all inner components too - and again, the same result - it just always gives me the router error, and then shows index page rendered on every route (together with content which should be there)The only thing which 'helped' - is not to specify
/
route for the plugin. Then, My index component is not pre rendered, and all others work in a good order. But obviously I'll need to have it pre rendered too.
Any help or suggestions highly welcomed! Maybe, I'm missing something quasar framework
specific?
I'm also using html-webpack-plugin
, can it be because of it?
Thanks!