JavaScript doesn't execute once pre-rendered page is loaded and each page reloads from the server
See original GitHub issueWhen I load the pre-rendered pages in my browser, each page I click reloads the page from the server. Also, non of my Vue JavaScript seems to work. For example, I have validation on a form and a submit handler, and none of that code is run.
plugins: [
...
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: path.join(__dirname, '../dist'),
// Required - Routes to render.
routes: [ '/', '/about', '/contact_us' ]
}),
...
That is my config in build/webpack.prod.conf.
Issue Analytics
- State:
- Created 5 years ago
- Comments:14
Top Results From Across the Web
How Next.Js application does not reload even though they are ...
On client-side navigations Next.js does work like a SPA. It'll only fetch the full HTML from the server on initial page load, from...
Read more >Puppeteer | Puppeteer
Puppeteer is a Node.js library which provides a high-level API to control ... Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. ......
Read more >Rendering on the Web
Running page logic and rendering on the server makes it possible to avoid sending lots of JavaScript to the client, which helps achieve...
Read more >Server-Side Rendering (SSR) - Vue.js
Server -rendered markup doesn't need to wait until all JavaScript has been downloaded and executed to be displayed, so your user will see...
Read more >Why Efficient Hydration in JavaScript Frameworks is so ...
Most frameworks hydration ready code is larger than their typical client ... More importantly, islands means server rendering each page on ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are no JS errors in the console.
And wow, data-server-rendered=“true” did the trick. Should this be listed in the prerender-spa-plugin documentation? I found that mentioned here:
https://ssr.vuejs.org/guide/hydration.html
But I wouldn’t have known to use that, especially since that’s in the server side render documentation.
My JS functions also stopped working after prerendering…
data-server-rendered="true"
solved my issue… thx!