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

Skip to content

Bug: should generate conflict-less name for duplicated generated names #364

@underfin

Description

@underfin

The current implementation assigned symbol name is append ${count} if the symbol is conflicting. But the new name maybe also happen conflict. See blowing example.

Input

// shared.js
const a = 'shared.js'

export { a }

// main.js
import { a as a2 } from './shared'
const a = 'index.js'
const a$1 = 'index.js'

console.log(a, a2, a$1)

Build Output

// shared.js
const a = 'shared.js'


// main.js

const a$1 = 'index.js'
const a$1 = 'index.js'

console.log(a$1, a, a$1)

We should assign a name with the current scope that is not a used name, like esbuild findNameUse https://github.com/evanw/esbuild/blob/main/internal/renamer/renamer.go#L564. We need to collect the all symbols for scope at first, we only collect unresolved symbols at now.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions