diff --git a/crates/oxc_minifier/src/options.rs b/crates/oxc_minifier/src/options.rs index 30d88d41956ea..927d80ef83ada 100644 --- a/crates/oxc_minifier/src/options.rs +++ b/crates/oxc_minifier/src/options.rs @@ -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() + } } } diff --git a/crates/oxc_minifier/tests/ast_passes/remove_dead_code.rs b/crates/oxc_minifier/tests/ast_passes/remove_dead_code.rs index b0e8a3fe6bb7e..c5cacf8edbc8d 100644 --- a/crates/oxc_minifier/tests/ast_passes/remove_dead_code.rs +++ b/crates/oxc_minifier/tests/ast_passes/remove_dead_code.rs @@ -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]