-
Notifications
You must be signed in to change notification settings - Fork 698
Description
Reproduction link or steps
What is expected?
The unused branch get removed, like Rollup's output:
// dist/output_rollup/main.js
const bar = "BAR";
function main() {
console.log(bar);
}
export { main };What is actually happening?
The unused branch still exists:
// dist/output_rolldown/main.js
//#region src/bar.js
const bar = "BAR";
//#endregion
//#region src/foo.js
const foo = false;
var foo_default = foo;
//#endregion
//#region src/main.js
function main() {
if (foo_default) console.warn("I expected this warning to be removed in the final bundle.");
console.log(bar);
}
//#endregion
export { main };System Info
System:
OS: macOS 15.3.1
CPU: (8) arm64 Apple M2
Memory: 3.25 GB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.1 - /opt/homebrew/opt/node@20/bin/node
Yarn: 1.22.22 - /opt/homebrew/opt/node@20/bin/yarn
npm: 10.8.2 - /opt/homebrew/opt/node@20/bin/npm
pnpm: 10.8.1 - /opt/homebrew/bin/pnpm
bun: 1.2.9 - /opt/homebrew/bin/bun
Browsers:
Brave Browser: 122.1.63.169
Chrome: 135.0.7049.96
Chrome Canary: 137.0.7138.0
Safari: 18.3
Safari Technology Preview: 18.2
npmPackages:
rolldown: 1.0.0-beta.8 => 1.0.0-beta.8Any additional comments?
I can find similar unoptimized behavior from ESBuild (evanw/esbuild#4148).
Reactions are currently unavailable