This is because the symbol b has two owner scopes, which makes rolldown consider it conflicted. So the symbol b was wrongly appiled the renaming logic and became b$1.
For input
// entry.js
(() => {
function a() {
b();
}
{
var b = () => {
};
}
a();
})();
The correct output should be
// entry.js
(() => {
function a() {
b();
}
{
var b = () => {
};
}
a();
})();
instead of https://github.com/rolldown-rs/rolldown/blob/b3c5e0178aec3381b54ed9bde3ee94bfa0fc0cc2/crates/rolldown/tests/esbuild/default/nested_scope_bug/artifacts.snap.
Related issues:
This is because the symbol
bhas two owner scopes, which makes rolldown consider it conflicted. So the symbolbwas wrongly appiled the renaming logic and becameb$1.For input
The correct output should be
instead of https://github.com/rolldown-rs/rolldown/blob/b3c5e0178aec3381b54ed9bde3ee94bfa0fc0cc2/crates/rolldown/tests/esbuild/default/nested_scope_bug/artifacts.snap.
Related issues: