Skip to content

[Bug]: Duplicate import binding names when external imports share the same local identifier #7444

@shulaoda

Description

@shulaoda

Reproduction link or steps

Since the new version of Rolldown hasn’t been released yet, it can only be reproduced locally on the latest branch.
https://repl.rolldown.rs/#eNp1kE1OxDAMha9iZZMBVWGf0ZwBiS1lkTbuKFJ+SupCUdW7kzQtdASzc/zsz+9lZh2TMzNe4yRoyLVn8vddsTY92+AHAgUXiPg+mognLp4UfzjXvkjNrdT8SMGisOF6UhU0uZeAyCTFEZeKxWCtDp9epMnOXA/3/1GKE+P6EAnoq0eY4WUbe+7JpGOwQBeDA76v89rvDgtI/lm5wFx7AOP7kSQUvHBISqytKos4EUavrIRX3vIKuOZvSVgyHafVkMZOjXY/k3KmeOoQaK1vIjyCGsBthjU/17H2LugxfVhhZm9ObOBVztDmAF3r+9D2DnQGIYSDZWMm6EciWEU4EFu+ATL8sVw=

// index.ts
const a = require('./a');
const b = require('./b');
console.log(a, b);

// a.ts
import * as m from 'd';
module.exports = m.default;

// b.ts
import * as m from 'c';
module.exports = { ...m };
// rolldown.config.js
import { defineConfig } from 'rolldown';

export default defineConfig({
  input: {
    entry: './index.ts',
  },
  external: ['c', 'd'],
});

What is expected?

import * as m$1 from "d";
import * as m from "c";

What is actually happening?

import * as m from "d";
import * as m from "c";

Any additional comments?

Related to #7425

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions