Skip to content

[vite:manifest] entryCssReferenceIds is not iterable with Vite v7+, manifest and tsx #22485

@arelra

Description

@arelra

Describe the bug

Using tsx to run a TS build script and Vite configuration to output a manifest results in the following error:

for (const [name, id] of entryCssReferenceIds) try {

[vite:manifest] entryCssReferenceIds is not iterable
    at Object.generateBundle (vite-manifest-repro/node_modules/vite/dist/node/chunks/config.js:29437:29)
    at Object.handler (vite-manifest-repro/node_modules/vite/dist/node/chunks/config.js:572:2)
    at <anonymous> (vite-manifest-repro/node_modules/rollup/dist/es/shared/node-entry.js:22981:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'PLUGIN_ERROR',
  plugin: 'vite:manifest',
  hook: 'generateBundle'
}

I suspect the issue is due to duplication of the module cache in CJS / ESM and different invocation paths using invalid module state.

Reproduction

https://github.com/arelra/vite-manifest-repro

Steps to reproduce

nvm use
npm i
npm run tsx-ts

System Info

System:
    OS: macOS 15.7.7
    CPU: (16) arm64 Apple M4
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.22.2
    Yarn: 1.22.22
    npm: 10.9.7
    pnpm: 10.33.0
    bun: 1.3.5
    Deno: 2.5.4
  Browsers:
    Chrome: 148
    Firefox: 150
    Safari: 26
  npmPackages:
    vite: 7.3.2 => 7.3.2

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions