Skip to content

Commit

Permalink
Optimize export *
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Nov 4, 2024
1 parent f29885b commit b531657
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,22 @@ impl DepGraph {
}
}

// Do not store export * in internal part fragments.
if let ModuleItem::ModuleDecl(ModuleDecl::ExportAll(export)) = &data[g].content {
// Preserve side effects of import caused by export *
chunk
.body
.push(ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl {
span: export.span,
specifiers: Default::default(),
src: export.src.clone(),
type_only: false,
with: export.with.clone(),
phase: Default::default(),
})));
continue;
}

chunk.body.push(data[g].content.clone());
}

Expand Down

0 comments on commit b531657

Please sign in to comment.