Skip to content

Conversation

@kevinkelleher12
Copy link

findNameUse looks across all parent scopes to determine if a name has been used. However, when findUnusedName begins trying to find an unused name, it uses only the nameCount in the current scope, which could require incrementing the name many times before avoiding collisions with a parent scope. With this change, findUnusedName will begin incrementing using the maximum nameCount across all scopes.

I have a bit of an unusual use case where I'm using esbuild in the browser with a plugin to fetch imports like https://cdn.jsdelivr.net/npm/react/+esm. Because these are already minified, there can be a very large number of name collisions at the topmost scope. This change speeds up builds for my use case by 2-3x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant