Skip to content

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

Description

@jaden-chen

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions