0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00

fix(solid-start): resolve SSR'd lazy() client assets via vite-plugin-solid's manifest

Solid 2's streaming renderer resolves the modules behind server-rendered
lazy() boundaries through its `manifest` render option: it emits stylesheet
links and modulepreloads for the lazy chunk and serializes the module→asset
map the client needs to preload it before hydration. TanStack Start never
provided that manifest — its own start manifest is route-keyed and
intentionally excludes dynamic-import chunks — so direct visits to routes
with SSR'd lazy() components rendered without the lazy chunk's CSS and
logged "Asset manifest returned no client assets" on every request.
(Pre-merge this was masked: the old Match tree re-rendered the boundary
client-side after the failed hydration, fetching the CSS late via Vite's
dynamic-import helper.)

Wire up vite-plugin-solid's `virtual:solid-manifest` (dev module-graph
resolver in dev, the client build's `.vite/manifest.json` in builds), kept
entirely inside the solid packages:

- solid-router ships an inert `ssr/clientAssetsManifest` stub that the
  renderers prefer over the route-keyed manifest when non-undefined
- solid-start's vite plugin swaps the stub for `virtual:solid-manifest` in
  the server environment (with `isEntry` neutralized so Solid doesn't
  duplicate the entry stylesheet Start already emits) and enables
  `build.manifest` for the client build
- bundlers without the plugin (rsbuild) keep the stub and current behavior

Fixes the two shared-widget lazy-CSS tests in the solid-start
start-manifest e2e (10/10 passing; selective-ssr and basic suites verified
unaffected).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Brenley Dueck 2026-08-05 13:10:36 -05:00
commit 99756c0710
4 changed files with 91 additions and 3 deletions