Skip to content

[Bug]: Duplicate default export on import + require usage #6571

@Gugustinette

Description

@Gugustinette

Reproduction link or steps

Have some input code like this :

// Require
const required = require('./file.json')

// Dynamic Import
const dynamicRes = await import('./file.json')

Reproduction : https://github.com/Gugustinette/rolldown-import-require-repro

What is expected?

This is what one of the input file should look I guess :

import { require_file } from "./file-DuStti8x.js";

export default require_file();

What is actually happening?

This is how it looks right now :

import { require_file } from "./file-DuStti8x.js";

export default require_file();

export { file_default as default };

There are 2 default exports, which causes an error whenever running/importing associated modules.

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 111.30 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 11.5.2 - /opt/homebrew/bin/npm
    pnpm: 10.8.1 - /opt/homebrew/bin/pnpm
    bun: 1.2.19 - /Users/augustinmercier/.bun/bin/bun
    Deno: 2.3.3 - /Users/augustinmercier/.deno/bin/deno
    Watchman: 2025.05.26.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 141.0.7390.66
    Firefox: 121.0
    Safari: 17.5
  npmPackages:
    rolldown: ^1.0.0-beta.43 => 1.0.0-beta.43

Any additional comments?

No response

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions