feat(minifier): remove parenthesized expression for dce (#5439)

relates #5436
This commit is contained in:
Boshen 2024-09-04 12:58:39 +00:00
parent d9d7e7c596
commit ba4b68cf63
2 changed files with 9 additions and 1 deletions

View file

@ -93,6 +93,11 @@ impl CompressOptions {
}
pub fn dead_code_elimination() -> Self {
Self { fold_constants: true, remove_dead_code: true, ..Self::all_false() }
Self {
remove_syntax: true,
fold_constants: true,
remove_dead_code: true,
..Self::all_false()
}
}
}

View file

@ -78,6 +78,9 @@ fn dce_if_statement() {
"const a = { fn: function() { if (true) { foo; } } }",
"const a = { fn: function() { { foo; } } }",
);
// parenthesized
test("if (!!(false)) { REMOVE; } else { KEEP; }", "{ KEEP }");
}
#[test]