frandiox / vite-ssr

Use Vite for server side rendering in Node
MIT License
829 stars 92 forks source link

Enable hydration for Vue apps #129

Closed CyberAP closed 2 years ago

CyberAP commented 2 years ago

Right now Vue apps are not hydrated on a client due to a createApp used in a client bundle, instead of createSSRApp. The latter is what enables hyration on a client.

To verify this set a breakpoint in a e.isMounted else condition in a vendor chunk here: https://vercelvitessr.vercel.app/ (this site is using vite-ssr).

image

Then check how the DOM looks when it triggers.

After the change the hydration should work as expected.

frandiox commented 2 years ago

@CyberAP Thanks! Turns out I was using createSSRApp in entry-server and it had to be the other way around 😅