Skip to content

Manifest contains stale CSS files after Rolldown Deduplication #22856

Description

@illusionaries

Describe the bug

.vite/manifest.json and .vite/ssr-manifest.json contains stale CSS files after Rolldown dedups file with same hash.

When Rolldown emits two files with different names, but same content hash, it dedups them, leaving the one with shorter fileName. The deduplication process happens through the emitting process, replacing the referenceId -> fileName mapping (internally in Rolldown) multiple times.

When Vite creates manifest/ssr-manifest, it tracks chunk.viteMetadata.ImportedAssets and ImportedCss by looking up the referenceId -> fileName with the referenceId returned by emitFile. Once Rolldown decides to deduplicate with a shorter fileName, previously returned longer fileNames, already stored in ImportedAssets/ImportedCss, became stale. Thus the final manifest contains stale files.

Reproduction

https://stackblitz.com/fork/github/illusionaries/dedup

Steps to reproduce

Run npm install and npx vite build --manifest --ssrManifest.

I was able to reproduce the bug with [email protected], both with [email protected] and [email protected]), and with dev branch vite, with [email protected] only.

With previously mentioned reproduction repo, building with dev branch vite and [email protected] emits barA-g7pxOomj.css instead of foo-g7pxOomj.css for some reason, which is obviously not the shortest fileName. This behavior accidentally fixed the issue.

System Info

System:
    OS: macOS 27.0
    CPU: (8) arm64 Apple M2
    Memory: 65.03 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.18.0 - /Users/djdjz7/.vite-plus/js_runtime/node/24.18.0/bin/node
    Yarn: 4.9.2 - /usr/local/bin/yarn
    npm: 11.16.0 - /Users/djdjz7/.vite-plus/js_runtime/node/24.18.0/bin/npm
    bun: 1.3.14 - /Users/djdjz7/.bun/bin/bun
    Deno: 2.7.4 - /opt/homebrew/bin/deno
    Watchman: 2026.03.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 149.0.7827.201
    Safari: 27.0
  npmPackages:
    rolldown: 1.1.3 => 1.1.3 
    vite: ^8.1.3 => 8.1.3

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vitefeat: buildp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions