Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: __toESM is not defined with format: 'cjs' and multiple inputs #2903

@filipsobol

Description

@filipsobol

Reproduction link or steps

  1. Open https://stackblitz.com/edit/github-37iyum?file=rolldown.config.mjs
  2. Run node ./dist/entry.cjs

What is expected?

When rolldown:runtime code is moved to a separate chunk (to avoid code repetition), the __toESM calls should be rewritten to require_chunk.__toESM.

What is actually happening?

The rolldown:runtime code is moved to a separate chunk, but the __toESM calls are left as-is, resulting in a ReferenceError: __toESM is not defined error.

System Info

Binaries:
    Node: 18.20.4
    Yarn: 1.22.21
    npm: 10.7.0
    pnpm: 9.7.1
  Browsers:
    Chrome: 131
  npmPackages:
    rolldown: nightly => 0.14.0-snapshot-bd95eb1-20241124003631

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions