Skip to content

Commit

Permalink
[Turbopack] make the single module graph a root task (#74778)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Jan 13, 2025
1 parent 9fd30a5 commit 5db5f13
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/next-api/src/module_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,13 @@ impl ReducedGraphs {
}
}

// This is a performance optimization. This function is a root aggregation function that aggregates
// over the whole subgraph.
#[turbo_tasks::function]
async fn get_global_module_graph(project: ResolvedVc<Project>) -> Vc<SingleModuleGraph> {
SingleModuleGraph::new_with_entries(project.get_all_entries())
}

#[turbo_tasks::function(operation)]
async fn get_reduced_graphs_for_endpoint_inner_operation(
project: ResolvedVc<Project>,
Expand All @@ -592,7 +599,9 @@ async fn get_reduced_graphs_for_endpoint_inner_operation(
false,
vec![
async move {
SingleModuleGraph::new_with_entries(project.get_all_entries())
get_global_module_graph(*project)
.resolve_strongly_consistent()
.await?
.to_resolved()
.await
}
Expand Down

0 comments on commit 5db5f13

Please sign in to comment.