From e41492bca348a4585b92ff0b47826891d051d7a4 Mon Sep 17 00:00:00 2001 From: austaras Date: Tue, 7 May 2024 11:40:19 +0800 Subject: [PATCH] mod(es/minifier): Remove unnecessary check --- .../swc_ecma_minifier/src/compress/optimize/iife.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs index 2ea598c69811..fdc82e11237e 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs @@ -751,18 +751,6 @@ impl Optimizer<'_> { } } - // We should not add a variable to top level scope if the user has disabled it. - // - // See https://github.com/swc-project/swc/issues/8909 - if !self.options.top_level() && self.ctx.in_top_level() { - for s in body.stmts.iter() { - if let Stmt::Decl(Decl::Var(..)) = s { - log_abort!("iife: [x] Cannot inline because of top level scope"); - return false; - } - } - } - if !body.stmts.iter().all(|stmt| match stmt { Stmt::Decl(Decl::Var(var)) if matches!(