Skip to content

Commit

Permalink
perf(turbopack): Do not store export star in internal fragments (verc…
Browse files Browse the repository at this point in the history
…el#71550)

### What?

Do not store `export *` in internal fragments.

### Why?

It results in large number of fragments.

### How?

Closes PACK-3264
  • Loading branch information
kdy1 authored and stipsan committed Nov 6, 2024
1 parent f84ac1d commit ede9a63
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 @@ -624,6 +624,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 ede9a63

Please sign in to comment.