Skip to content

Commit

Permalink
Optimize export *
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 22, 2024
1 parent df8cc5c commit 735df8c
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 @@ -561,6 +561,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 735df8c

Please sign in to comment.