Skip to main content

Hydration Mechanics

The framework ensures that the client only downloads the JavaScript required for the components actually present on the page through a coordinated hand-off between Rspack and the SSR engine.

The HTML Injection Flow

1. Build-Time Manifest (loadable.json)

The ReactLoadablePlugin emits a loadable.json file that maps Logical Module Names (e.g., shop/components/Carousel) to their physical hashed assets (e.g., carousel.a1b2c3.js).

2. Server-Side Component Capture

Every Loadable component reports its module name to the __LoadableContext during the SSR pass. The Renderer.tsx collects these into a Set.

3. Manifest Cross-Referencing

The RenderHelper cross-references the rendered modules against loadable.json to identify the specific JS/CSS chunks needed.

4. Stream Injection

The ScriptsPlugin and StylesPlugin inject the necessary <script> and <link> tags directly into the HTML payload stream.