vitejs / vitejs/vite-plugin-react

RSC asset manifest retains removed CSS-only JS chunks in production

Open
#1,466 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
269
Avg merge
1d 3h
Merged PRs (30d)
19

Description

With @vitejs/plugin-rsc@0.5.34, vite@8.3.0, and vinext@1.0.0-beta.9, an RSC production asset manifest can retain a shared CSS-only JavaScript chunk that Vite removes before writing client output. SSR then emits a module preload to a nonexistent file (404).

Minimal arrangement using the Vinext App Router:

app/page.tsx -> app/client.tsx ("use client") -> import "./shared.css"
app/second/page.tsx -> app/other-client.tsx ("use client") -> import "./shared.css"

Both pages render their corresponding client component. shared.css contains a simple nonempty selector. Build with a second-origin assetPrefix, start the production app, and inspect dist/server/__vite_rsc_assets_manifest.js and dist/client. Our isolated fixture generates a shared-*.js dependency in the manifest but no corresponding client file. The browser requests that missing module. The reproduction has no authentication or recovery service worker.

In the installed plugin bundle, rsc:virtual:vite-rsc/assets-manifest collects client dependencies in a normal generateBundle hook. Vite's CSS postprocessing subsequently removes pure CSS chunks and updates imports. Running this asset-manifest hook with order: "post" resolves the reproduced missing-module requests while retaining the shared CSS dependency. Both client navigation and a warm-cache reload pass in the fixture after that change.

Is moving this hook after CSS postprocessing the appropriate upstream fix, or is another supported configuration intended? This is separate from stylesheet crossorigin issue #1464. We currently keep a source/version-checked local patch and will remove it after a released upstream correction passes the reproduction.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RSC asset-manifest entry rsc:virtual:vite-rsc/assets-manifest and its generateBundle hook, then reproduce the issue with the described Vinext App Router fixture. Verify the manifest against dist/client and confirm that client navigation and a warm-cache reload no longer request a missing module after CSS postprocessing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.