diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs index a9bcc4bfeaa22e..37c85d3e2334ae 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs @@ -417,13 +417,15 @@ impl DepGraph { } for g in group { - // Skip directives + // Skip directives, as we copy them to each modules. if let ModuleItem::Stmt(Stmt::Expr(ExprStmt { - expr: box Expr::Lit(Lit::Str(_)), + expr: box Expr::Lit(Lit::Str(s)), .. })) = &data[g].content { - continue; + if s.value.starts_with("use ") { + continue; + } } chunk.body.push(data[g].content.clone()); }