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.
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
Build Output
We should assign a name with the current scope that is not a used name, like esbuild
findNameUsehttps://github.com/evanw/esbuild/blob/main/internal/renamer/renamer.go#L564. We need to collect the all symbols for scope at first, we only collectunresolvedsymbols at now.