Skip to content

feat(rsc): initial bundledDev support#1297

Open
nihgwu wants to merge 1 commit into
vitejs:mainfrom
nihgwu:neo/rsc-bundled-dev
Open

feat(rsc): initial bundledDev support#1297
nihgwu wants to merge 1 commit into
vitejs:mainfrom
nihgwu:neo/rsc-bundled-dev

Conversation

@nihgwu

@nihgwu nihgwu commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #1217.

  • Use the RSC browser wrapper as the bundledDev client entry and statically include reachable client references.
  • Include server-imported CSS and assets in the client bundle and derive the development assets manifest from bundled output.
  • Preserve React refresh and ordinary client HMR while avoiding custom HMR state, timers, cache invalidation, and Vite internal APIs.
  • Document that server-graph and client-boundary changes require a dev-server restart until Vite exposes an atomic bundledDev rebuild-and-reload operation for plugins.

This includes the build-only generateBundle guard also proposed in #1296 as part of the broader bundledDev integration.

@nihgwu nihgwu changed the title feat(rsc): support bundled dev (fix #1217) feat(rsc): support bundled dev Jul 21, 2026
@nihgwu nihgwu changed the title feat(rsc): support bundled dev feat(rsc): initial bundledDev support Jul 21, 2026
@nihgwu
nihgwu marked this pull request as ready for review July 21, 2026 10:15
@nihgwu

nihgwu commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

I tested this PR against a real application with #1295 applied and Vite 8.1.4. The client appeared to hydrate, but the test uncovered a correctness blocker around SSR CSS.

Evidence:

  • Normal dev with JavaScript disabled rendered 42 stylesheet links and the complete styled layout.
  • bundledDev rendered zero stylesheet links and only one unrelated inline style.
  • With JavaScript enabled, route-specific and server-only CSS was still missing.

The underlying problem is that bundledDev transforms client CSS into JavaScript calling updateStyle, serves only bundled memoryFiles, and does not mount the normal transform middleware. plugin-rsc therefore has no valid transformed stylesheet URL to emit into streamed SSR HTML. Crawling the initial server graph is also insufficient because route-specific CSS can be discovered only during the RSC render.

Restoring source CSS URLs produces 404s. Avoiding the links makes SSR depend on JavaScript and still misses server-only styles. Custom CSS middleware, data URLs, or parsing Vite’s generated JavaScript would reproduce Vite internals and would not be an upstream-ready solution.

This PR should therefore remain blocked and should not close #1217 until Vite exposes a server-side way to obtain servable bundled output URLs for CSS/modules and a safe full-rebuild operation for server-graph changes.

Related Vite core API discussion: vitejs/vite#22991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full bundle support to vite rsc plugin

1 participant