From Component API to SSR heaven
summary
Builds a tiny SSR stack using Svelte 5’s render API, esbuild in-memory bundling and Fastify with fastify-type-provider-zod for query validation, then outputs server HTML plus a separate hydratable client bundle. Creates a package called svelte inline bundler, injects CSS into the client bundle, and wires a simple WebSocket HMR that swaps the hydrate script so CSS updates apply instantly. Reactivity and hydration work after adding IDs and a hydrate entry, but full state-preserving HMR is left unimplemented.
AI-written summary · about
chapters (15)
- 0:00Cringy title origin
- 1:08Why I started with SvelteKit
- 2:31Moving from SvelteKit to Svelte
- 5:26Today's agenda overview
- 5:47Setting up SSR in Svelte
- 7:14Registering views on server
- 9:02Adding styles to SSR
- 11:11Passing props to components
- 13:48Achieving reactivity
- 15:20Hydrating server-rendered output
- 20:05Sending hydratable bundle to client
- 23:17Why browser refresh is bad
- 24:00Building homemade HMR
- 28:21CSS HMR from local server
- 30:14Summary and Q&A
