diff --git a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs index 257e0a5db04d..28d5f3c4cbf9 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs @@ -15,7 +15,7 @@ use crate::debug::dump; use crate::{ compress::optimize::{util::Remapper, Ctx}, mode::Mode, - util::{idents_captured_by, idents_used_by, make_number}, + util::{contains_eval, idents_captured_by, idents_used_by, make_number}, }; /// Methods related to the option `negate_iife`. @@ -730,11 +730,7 @@ where // Abort on eval. // See https://github.com/swc-project/swc/pull/6478 - // - // We completetly abort on eval, because we cannot know whether a variable in - // upper scope will be afftected by eval. - // https://github.com/swc-project/swc/issues/6628 - if self.data.top.has_eval_call { + if contains_eval(body, false) { log_abort!("iife: [x] Aborting because of eval"); return false; }