Incremental adoption of SSR Vue w/ hydration #242
Replies: 3 comments 1 reply
-
The main question is whether your Vue-controlled parts need to render route-specific data. If your sprinkled Vue parts are using pure client-side data, then you can actually pre-render them at build time. You will then need:
So this whole setup is still non-trivial mostly because there's no ready made library/setup to do this, but technically this is possible. However, if your Vue-controlled parts need server-side data, then it would become significantly more complex as you would need dynamic Node.js SSR embedded as part of your server logic. And in that case the complexity would probably outweigh the gains. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply @yyx990803. My requirements look to lie in the second, 'progressively enhanced' camp - Vue components are not route-specific & need server-side data to initially render, e.g. a table of data only getting pagination & filtering controls on hydration. I'm fairly Svelte-ignorant but was intrigued to read from their docs that I could load a I guess the setup I'm imagining might look something like:
Theres the issue of component dependencies in the CSR bundles and probably a ton more that I'm not aware of but would be interested to get thoughts/insight into the issues here. I guess I really like the 'incrementally-adoptable' ethos of Vue & being able to write a contained |
Beta Was this translation helpful? Give feedback.
-
Noticing @chriscalo's thumbsup & stalking his repos I noticed he'd looked at similar thing which gave me some direction to have a punt: It's a little awkward but feel a defined approach could forge a direction for that incremental adoption of Vue, rather than a big bang rewrite of an existing app. Would appreciate thoughts. |
Beta Was this translation helpful? Give feedback.
-
I have a large, existing (server rendered) web app and I’d like to sprinkle it with the odd Vue component & have them hydrate on the client. It feels to me that this is one of the main “incrementally-adoptable” use-cases & yet I’m struggling to find tutorial/example material to help with my setup.
I don’t want to replace my existing app or run a full-page Vue app server-side.
Everything I've read on Vue SSR is that I have to create a server bundle of my Vue app's code, and use that for SSR & deliver the whole app bundle for CSR. Which leaves me wondering if what I want to do is even possible with Vue?
Any help/pointers to examples would be very gratefully received.
Beta Was this translation helpful? Give feedback.
All reactions