I have successfully integrated this plugin into my laravel-vue application and configured it within the laravel mix's webpack.mix.js file.
After running it via npm (using watch, dev, and prod modes), I encountered no errors. However, upon inspecting the rendered HTML file, I noticed error text inside the title tag and missing content inside the pre tag: http://prntscr.com/owcj6e
Here is my setup:
webpack.mix.js:
mix.webpackConfig({
plugins: [
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, "dist"),
routes: ["/", "/bulletin-board","/top-requests","/about-us","/sign-in"],
postProcess(renderedRoute) {
renderedRoute.html = renderedRoute.html
.replace(/<script (.*?)>/g, `<script $1 defer>`)
.replace(`id="app"`, `id="app" data-server-rendered="true"`)
return renderedRoute
},
renderer: new Renderer({
renderAfterTime: 5000,
headless: true
})
})
]
});
resources/js/routes.js
import Router from 'vue-router';
export const router = new Router({
mode : "history",
routes : [
// Routes configuration here
]
});
router.beforeEach((to, from, next) => {
// Route navigation logic here
})
resources/js/app.js
require('./bootstrap');
// Other imports and configurations here
const app = new Vue({
el: '#app',
// Vue initialization here
});
If you wish to check the detailed issue report, feel free to visit: https://github.com/SolarLiner/vue-cli-plugin-prerender-spa/issues/42
Your suggestions, advice, and assistance are greatly appreciated.
Many thanks.