While browsing Vue's official website, I came across a concise example demonstrating how to implement server-side rendering (SSR) using Vue.
(
https://stackblitz.com/edit/vue-ssr-example-qaztqn?file=package.json
)
Intrigued by this example, I decided to replicate it on my local machine and was able to run it successfully.
However, when I attempted to bundle Vue locally using Vite, I encountered an error related to hydration mismatch:
index.0977acf5.js:2980 Hydration completed but contains mismatches.
Prior to my modifications, the original example on the Vue site imported Vue from a CDN in its index.html
. My only alteration was to package Vue locally and reference the entire bundled JS file instead.
I have shared my unsuccessful attempt on GitHub:
https://github.com/yangjiang3973/vue-ssr-demo
If anyone could provide insight into why this hydration error occurred, I would greatly appreciate it!
Thank you in advance!