Skip to content

Commit 866efbe

Browse files
committed
check regex
1 parent 1903e8f commit 866efbe

File tree

1 file changed

+3
-1
lines changed
  • crates/swc_ecma_minifier/src/compress/optimize

1 file changed

+3
-1
lines changed

crates/swc_ecma_minifier/src/compress/optimize/iife.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,9 @@ impl Optimizer<'_> {
11541154
if decl.count
11551155
+ (params.len().saturating_sub(
11561156
args.iter()
1157-
.filter(|a| a.expr.is_ident() || a.expr.is_lit())
1157+
.filter(|a| {
1158+
a.expr.is_ident() || a.expr.as_lit().map(|l| !l.is_regex()).unwrap_or(false)
1159+
})
11581160
.count(),
11591161
)) * 2
11601162
> 4

0 commit comments

Comments
 (0)