Unverified Commit 12273f50 authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

fix(turbopack): Remove self-references from tree shaking results (#72567)

### What?

Make the graph acyclic while condensation graphs so that the self-references do not exist.

We are using `condensation` from `petgraph` and it has `make_acyclic: bool` option. I enabled it to make tree shaking a bit faster.

### Why?

Self-reference in the module graph means slower build and needless runtime operations.

### How?

Closes PACK-3439
parent d3d0f812
...@@ -715,7 +715,7 @@ impl DepGraph { ...@@ -715,7 +715,7 @@ impl DepGraph {
) -> InternedGraph<Vec<ItemId>> { ) -> InternedGraph<Vec<ItemId>> {
let graph = self.g.idx_graph.clone().into_graph::<u32>(); let graph = self.g.idx_graph.clone().into_graph::<u32>();
let condensed = condensation(graph, false); let condensed = condensation(graph, true);
let mut new_graph = InternedGraph::default(); let mut new_graph = InternedGraph::default();
......
...@@ -344,10 +344,8 @@ graph TD ...@@ -344,10 +344,8 @@ graph TD
N1 --> N7; N1 --> N7;
N2 --> N7; N2 --> N7;
N3 --> N8; N3 --> N8;
N7 --> N7;
N7 --> N4; N7 --> N4;
N7 --> N5; N7 --> N5;
N8 --> N8;
N8 --> N6; N8 --> N6;
N0 --> N10; N0 --> N10;
``` ```
......
...@@ -385,7 +385,6 @@ graph TD ...@@ -385,7 +385,6 @@ graph TD
N11 --> N12; N11 --> N12;
N11 --> N5; N11 --> N5;
N11 --> N8; N11 --> N8;
N11 -.-> N11;
N15 --> N14; N15 --> N14;
N2 --> N11; N2 --> N11;
N1 --> N14; N1 --> N14;
......
...@@ -588,7 +588,6 @@ graph TD ...@@ -588,7 +588,6 @@ graph TD
N17 --> N15; N17 --> N15;
N17 -.-> N16; N17 -.-> N16;
N17 -.-> N14; N17 -.-> N14;
N17 --> N17;
N17 -.-> N12; N17 -.-> N12;
N3 --> N18; N3 --> N18;
N5 --> N19; N5 --> N19;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment