From 22664a3a83d5aee8b851877c64b92516f0420016 Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 27 May 2023 19:12:51 +0800 Subject: [PATCH] fix(minifier): the mangle phase should come after the compress phase To align with terser --- crates/oxc_minifier/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_minifier/src/lib.rs b/crates/oxc_minifier/src/lib.rs index 273921c3b..93c6f2de5 100644 --- a/crates/oxc_minifier/src/lib.rs +++ b/crates/oxc_minifier/src/lib.rs @@ -46,12 +46,12 @@ impl<'a> Minifier<'a> { let ret = Parser::new(&allocator, self.source_text, self.source_type).parse(); let ret = AstLower::new(&allocator, self.source_type).build(&ret.program); let mut program = ret.program; - let mut semantic = ret.semantic; + let semantic = ret.semantic; + let mut semantic = + Compressor::new(&allocator, semantic, self.options.compress).build(&mut program); if self.options.mangle { semantic.mangle(); } - let semantic = - Compressor::new(&allocator, semantic, self.options.compress).build(&mut program); Printer::new(self.source_text.len(), self.options.print) .with_mangle(semantic.symbol_table, self.options.mangle) .build(&program)