Skip to content

[Bug]: Circular import generated in vite dev mode #9485

Description

@rob-clarke

Reproduction link or steps

https://github.com/rob-clarke/rolldown-issue

  • Run npm run dev (start vite dev server)
  • Open site in browser
  • Observe failure to import roslib due to circular import in generated module

What is expected?

Running vite dev results in a functional JS module capable of being loaded by the browser.

What is actually happening?

The bundled module has a circular import that results in a failure to load the module. Reported error is:
undefined is not a function when attempting to call __CommonJSMin

System Info

Running in WSL. Browser is Firefox 150.0.3
  System:
    OS: Linux 6.6 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 1.51 GB / 5.79 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 24.15.0 - /home/rc13011/.nvm/versions/node/v24.15.0/bin/node
    npm: 11.12.1 - /home/rc13011/.nvm/versions/node/v24.15.0/bin/npm

Any additional comments?

Bug encountered when attempting to use roslib with latest vite. roslib has a dependency on eventemitter3 which has a ESM interface that exports an imports from a CJS file. This appears to be a trigger of this issue.

Using "overrides": {"rolldown": "1.0.0"} does not show the same behaviour.

Appears related to #9401 but as I understand it this repro does not use dynamic import or require (unless vite dev injects a dynamic import).

Metadata

Metadata

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions