Unverified Commit 2dda444c authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: don't read binding_usage in dev (#86722)

I'm debating whether this should be `Option<BindingUsage>` instead, so that we can detect if you built the graph without the binding_usage but then still try to enable `remove_unused_exports` (which would now silently noop and never tree shaking anything).
parent 64e537cc
...@@ -858,7 +858,10 @@ impl AppProject { ...@@ -858,7 +858,10 @@ impl AppProject {
) -> Result<Vc<BaseAndFullModuleGraph>> { ) -> Result<Vc<BaseAndFullModuleGraph>> {
if *self.project.per_page_module_graph().await? { if *self.project.per_page_module_graph().await? {
let next_mode = self.project.next_mode(); let next_mode = self.project.next_mode();
let should_trace = next_mode.await?.is_production(); let next_mode_ref = next_mode.await?;
let should_trace = next_mode_ref.is_production();
let should_read_binding_usage = next_mode_ref.is_production();
let client_shared_entries = client_shared_entries let client_shared_entries = client_shared_entries
.await? .await?
.into_iter() .into_iter()
...@@ -874,7 +877,8 @@ impl AppProject { ...@@ -874,7 +877,8 @@ impl AppProject {
let ServerEntries { let ServerEntries {
server_utils, server_utils,
server_component_entries, server_component_entries,
} = &*find_server_entries(*rsc_entry, should_trace).await?; } = &*find_server_entries(*rsc_entry, should_trace, should_read_binding_usage)
.await?;
let graph = SingleModuleGraph::new_with_entries_visited_intern( let graph = SingleModuleGraph::new_with_entries_visited_intern(
vec![ vec![
...@@ -891,6 +895,7 @@ impl AppProject { ...@@ -891,6 +895,7 @@ impl AppProject {
], ],
VisitedModules::empty(), VisitedModules::empty(),
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(graph); graphs.push(graph);
let mut visited_modules = VisitedModules::from_graph(graph); let mut visited_modules = VisitedModules::from_graph(graph);
...@@ -908,6 +913,7 @@ impl AppProject { ...@@ -908,6 +913,7 @@ impl AppProject {
vec![ChunkGroupEntry::Entry(vec![ResolvedVc::upcast(*module)])], vec![ChunkGroupEntry::Entry(vec![ResolvedVc::upcast(*module)])],
visited_modules, visited_modules,
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(graph); graphs.push(graph);
let is_layout = module.server_path().await?.file_stem() == Some("layout"); let is_layout = module.server_path().await?.file_stem() == Some("layout");
...@@ -929,6 +935,7 @@ impl AppProject { ...@@ -929,6 +935,7 @@ impl AppProject {
vec![ChunkGroupEntry::Entry(client_shared_entries)], vec![ChunkGroupEntry::Entry(client_shared_entries)],
VisitedModules::empty(), VisitedModules::empty(),
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(graph); graphs.push(graph);
VisitedModules::from_graph(graph) VisitedModules::from_graph(graph)
...@@ -938,6 +945,7 @@ impl AppProject { ...@@ -938,6 +945,7 @@ impl AppProject {
vec![rsc_entry_chunk_group], vec![rsc_entry_chunk_group],
visited_modules, visited_modules,
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(graph); graphs.push(graph);
visited_modules = visited_modules.concatenate(graph); visited_modules = visited_modules.concatenate(graph);
...@@ -948,6 +956,7 @@ impl AppProject { ...@@ -948,6 +956,7 @@ impl AppProject {
additional_entries.owned().await?, additional_entries.owned().await?,
visited_modules, visited_modules,
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(additional_module_graph); graphs.push(additional_module_graph);
...@@ -1282,12 +1291,15 @@ impl AppEndpoint { ...@@ -1282,12 +1291,15 @@ impl AppEndpoint {
.get_next_dynamic_imports_for_endpoint(*rsc_entry) .get_next_dynamic_imports_for_endpoint(*rsc_entry)
.await?; .await?;
let is_production = project.next_mode().await?.is_production();
let client_references = let client_references =
ClientReferencesGraphs::new(*module_graphs.base, per_page_module_graph) ClientReferencesGraphs::new(*module_graphs.base, per_page_module_graph)
.get_client_references_for_endpoint( .get_client_references_for_endpoint(
*rsc_entry, *rsc_entry,
matches!(this.ty, AppEndpointType::Page { .. }), matches!(this.ty, AppEndpointType::Page { .. }),
project.next_mode().await?.is_production(), is_production,
is_production,
) )
.to_resolved() .to_resolved()
.await?; .await?;
......
...@@ -460,6 +460,7 @@ impl ClientReferencesGraphs { ...@@ -460,6 +460,7 @@ impl ClientReferencesGraphs {
entry: Vc<Box<dyn Module>>, entry: Vc<Box<dyn Module>>,
has_layout_segments: bool, has_layout_segments: bool,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<ClientReferenceGraphResult>> { ) -> Result<Vc<ClientReferenceGraphResult>> {
let span = tracing::info_span!("collect all client references for endpoint"); let span = tracing::info_span!("collect all client references for endpoint");
async move { async move {
...@@ -477,7 +478,9 @@ impl ClientReferencesGraphs { ...@@ -477,7 +478,9 @@ impl ClientReferencesGraphs {
// messes up the order of the server_component_entries. // messes up the order of the server_component_entries.
let server_entries = async { let server_entries = async {
if has_layout_segments { if has_layout_segments {
let server_entries = find_server_entries(entry, include_traced).await?; let server_entries =
find_server_entries(entry, include_traced, include_binding_usage)
.await?;
Ok(Some(server_entries)) Ok(Some(server_entries))
} else { } else {
Ok(None) Ok(None)
......
...@@ -728,7 +728,10 @@ impl PageEndpoint { ...@@ -728,7 +728,10 @@ impl PageEndpoint {
if *project.per_page_module_graph().await? { if *project.per_page_module_graph().await? {
let next_mode = project.next_mode(); let next_mode = project.next_mode();
let should_trace = next_mode.await?.is_production(); let next_mode_ref = next_mode.await?;
let should_trace = next_mode_ref.is_production();
let should_read_binding_usage = next_mode_ref.is_production();
let ssr_chunk_module = self.internal_ssr_chunk_module().await?; let ssr_chunk_module = self.internal_ssr_chunk_module().await?;
// Implements layout segment optimization to compute a graph "chain" for document, app, // Implements layout segment optimization to compute a graph "chain" for document, app,
// page // page
...@@ -745,6 +748,7 @@ impl PageEndpoint { ...@@ -745,6 +748,7 @@ impl PageEndpoint {
vec![ChunkGroupEntry::Shared(module)], vec![ChunkGroupEntry::Shared(module)],
visited_modules, visited_modules,
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(graph); graphs.push(graph);
visited_modules = visited_modules.concatenate(graph); visited_modules = visited_modules.concatenate(graph);
...@@ -754,6 +758,7 @@ impl PageEndpoint { ...@@ -754,6 +758,7 @@ impl PageEndpoint {
vec![ChunkGroupEntry::Entry(vec![ssr_chunk_module.ssr_module])], vec![ChunkGroupEntry::Entry(vec![ssr_chunk_module.ssr_module])],
visited_modules, visited_modules,
should_trace, should_trace,
should_read_binding_usage,
); );
graphs.push(graph); graphs.push(graph);
......
...@@ -1065,7 +1065,8 @@ impl Project { ...@@ -1065,7 +1065,8 @@ impl Project {
entry: ResolvedVc<Box<dyn Module>>, entry: ResolvedVc<Box<dyn Module>>,
) -> Result<Vc<ModuleGraph>> { ) -> Result<Vc<ModuleGraph>> {
Ok(if *self.per_page_module_graph().await? { Ok(if *self.per_page_module_graph().await? {
ModuleGraph::from_entry_module(*entry, self.next_mode().await?.is_production()) let is_production = self.next_mode().await?.is_production();
ModuleGraph::from_entry_module(*entry, is_production, is_production)
} else { } else {
*self.whole_app_module_graphs().await?.full *self.whole_app_module_graphs().await?.full
}) })
...@@ -1077,6 +1078,7 @@ impl Project { ...@@ -1077,6 +1078,7 @@ impl Project {
evaluatable_assets: Vc<EvaluatableAssets>, evaluatable_assets: Vc<EvaluatableAssets>,
) -> Result<Vc<ModuleGraph>> { ) -> Result<Vc<ModuleGraph>> {
Ok(if *self.per_page_module_graph().await? { Ok(if *self.per_page_module_graph().await? {
let is_production = self.next_mode().await?.is_production();
let entries = evaluatable_assets let entries = evaluatable_assets
.await? .await?
.iter() .iter()
...@@ -1085,7 +1087,8 @@ impl Project { ...@@ -1085,7 +1087,8 @@ impl Project {
.collect(); .collect();
ModuleGraph::from_modules( ModuleGraph::from_modules(
Vc::cell(vec![ChunkGroupEntry::Entry(entries)]), Vc::cell(vec![ChunkGroupEntry::Entry(entries)]),
self.next_mode().await?.is_production(), is_production,
is_production,
) )
} else { } else {
*self.whole_app_module_graphs().await?.full *self.whole_app_module_graphs().await?.full
...@@ -2000,9 +2003,14 @@ async fn whole_app_module_graph_operation( ...@@ -2000,9 +2003,14 @@ async fn whole_app_module_graph_operation(
mark_root(); mark_root();
let next_mode = project.next_mode(); let next_mode = project.next_mode();
let should_trace = next_mode.await?.is_production(); let next_mode_ref = next_mode.await?;
let base_single_module_graph = let should_trace = next_mode_ref.is_production();
SingleModuleGraph::new_with_entries(project.get_all_entries(), should_trace); let should_read_binding_usage = next_mode_ref.is_production();
let base_single_module_graph = SingleModuleGraph::new_with_entries(
project.get_all_entries(),
should_trace,
should_read_binding_usage,
);
let base_visited_modules = VisitedModules::from_graph(base_single_module_graph); let base_visited_modules = VisitedModules::from_graph(base_single_module_graph);
let base = ModuleGraph::from_single_graph(base_single_module_graph); let base = ModuleGraph::from_single_graph(base_single_module_graph);
...@@ -2030,6 +2038,7 @@ async fn whole_app_module_graph_operation( ...@@ -2030,6 +2038,7 @@ async fn whole_app_module_graph_operation(
additional_entries, additional_entries,
base_visited_modules, base_visited_modules,
should_trace, should_trace,
should_read_binding_usage,
); );
let full_with_unused_references = let full_with_unused_references =
......
...@@ -81,6 +81,7 @@ pub struct ServerEntries { ...@@ -81,6 +81,7 @@ pub struct ServerEntries {
pub async fn find_server_entries( pub async fn find_server_entries(
entry: ResolvedVc<Box<dyn Module>>, entry: ResolvedVc<Box<dyn Module>>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<ServerEntries>> { ) -> Result<Vc<ServerEntries>> {
async move { async move {
let emit_spans = tracing::enabled!(Level::INFO); let emit_spans = tracing::enabled!(Level::INFO);
...@@ -97,8 +98,9 @@ pub async fn find_server_entries( ...@@ -97,8 +98,9 @@ pub async fn find_server_entries(
}, },
)], )],
FindServerEntries { FindServerEntries {
include_traced,
emit_spans, emit_spans,
include_traced,
include_binding_usage,
}, },
) )
.await .await
...@@ -130,9 +132,11 @@ pub async fn find_server_entries( ...@@ -130,9 +132,11 @@ pub async fn find_server_entries(
} }
struct FindServerEntries { struct FindServerEntries {
emit_spans: bool,
/// Whether to walk ChunkingType::Traced references /// Whether to walk ChunkingType::Traced references
include_traced: bool, include_traced: bool,
emit_spans: bool, /// Whether to read the binding usage information from modules
include_binding_usage: bool,
} }
#[derive( #[derive(
...@@ -173,6 +177,7 @@ impl Visit<FindServerEntriesNode> for FindServerEntries { ...@@ -173,6 +177,7 @@ impl Visit<FindServerEntriesNode> for FindServerEntries {
fn edges(&mut self, node: &FindServerEntriesNode) -> Self::EdgesFuture { fn edges(&mut self, node: &FindServerEntriesNode) -> Self::EdgesFuture {
let include_traced = self.include_traced; let include_traced = self.include_traced;
let include_binding_usage = self.include_binding_usage;
let parent_module = match node { let parent_module = match node {
// This should never occur since we always skip visiting these // This should never occur since we always skip visiting these
// nodes' edges. // nodes' edges.
...@@ -185,10 +190,15 @@ impl Visit<FindServerEntriesNode> for FindServerEntries { ...@@ -185,10 +190,15 @@ impl Visit<FindServerEntriesNode> for FindServerEntries {
}; };
let emit_spans = self.emit_spans; let emit_spans = self.emit_spans;
async move { async move {
// Pass include_traced to reuse the same cached `primary_chunkable_referenced_modules` // Pass include_traced and include_binding_usage to reuse the same cached
// task result, but the traced references will be filtered out again afterwards. // `primary_chunkable_referenced_modules` task result, but the traced references will be
let referenced_modules = // filtered out again afterwards.
primary_chunkable_referenced_modules(parent_module, include_traced).await?; let referenced_modules = primary_chunkable_referenced_modules(
parent_module,
include_traced,
include_binding_usage,
)
.await?;
let referenced_modules = referenced_modules let referenced_modules = referenced_modules
.iter() .iter()
......
...@@ -756,7 +756,7 @@ async fn get_mock_stylesheet( ...@@ -756,7 +756,7 @@ async fn get_mock_stylesheet(
.module(); .module();
let entries = get_evaluate_entries(mocked_response_asset, asset_context, None); let entries = get_evaluate_entries(mocked_response_asset, asset_context, None);
let module_graph = ModuleGraph::from_modules(entries.graph_entries(), false); let module_graph = ModuleGraph::from_modules(entries.graph_entries(), false, false);
let root = mock_fs.root().owned().await?; let root = mock_fs.root().owned().await?;
let val = evaluate( let val = evaluate(
......
...@@ -308,6 +308,7 @@ async fn build_internal( ...@@ -308,6 +308,7 @@ async fn build_internal(
let mut module_graph = ModuleGraph::from_modules( let mut module_graph = ModuleGraph::from_modules(
Vc::cell(vec![ChunkGroupEntry::Entry(entries.clone())]), Vc::cell(vec![ChunkGroupEntry::Entry(entries.clone())]),
false, false,
true,
); );
let module_id_strategy = ResolvedVc::upcast( let module_id_strategy = ResolvedVc::upcast(
get_global_module_id_strategy(module_graph) get_global_module_id_strategy(module_graph)
......
...@@ -161,10 +161,13 @@ pub async fn create_web_entry_source( ...@@ -161,10 +161,13 @@ pub async fn create_web_entry_source(
.map(|&entry| ResolvedVc::upcast(entry)), .map(|&entry| ResolvedVc::upcast(entry)),
) )
.collect::<Vec<ResolvedVc<Box<dyn Module>>>>(); .collect::<Vec<ResolvedVc<Box<dyn Module>>>>();
let module_graph = let module_graph = ModuleGraph::from_modules(
ModuleGraph::from_modules(Vc::cell(vec![ChunkGroupEntry::Entry(all_modules)]), false) Vc::cell(vec![ChunkGroupEntry::Entry(all_modules)]),
.to_resolved() false,
.await?; false,
)
.to_resolved()
.await?;
let entries: Vec<_> = entries let entries: Vec<_> = entries
.into_iter() .into_iter()
......
...@@ -240,6 +240,7 @@ impl SingleModuleGraph { ...@@ -240,6 +240,7 @@ impl SingleModuleGraph {
entries: &GraphEntriesT, entries: &GraphEntriesT,
visited_modules: &FxIndexMap<ResolvedVc<Box<dyn Module>>, GraphNodeIndex>, visited_modules: &FxIndexMap<ResolvedVc<Box<dyn Module>>, GraphNodeIndex>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<Self>> { ) -> Result<Vc<Self>> {
let emit_spans = tracing::enabled!(Level::INFO); let emit_spans = tracing::enabled!(Level::INFO);
let root_edges = entries let root_edges = entries
...@@ -263,6 +264,7 @@ impl SingleModuleGraph { ...@@ -263,6 +264,7 @@ impl SingleModuleGraph {
visited_modules, visited_modules,
emit_spans, emit_spans,
include_traced, include_traced,
include_binding_usage,
}, },
) )
.await .await
...@@ -783,16 +785,26 @@ impl ModuleGraph { ...@@ -783,16 +785,26 @@ impl ModuleGraph {
pub fn from_entry_module( pub fn from_entry_module(
module: ResolvedVc<Box<dyn Module>>, module: ResolvedVc<Box<dyn Module>>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Vc<Self> { ) -> Vc<Self> {
Self::from_single_graph(SingleModuleGraph::new_with_entries( Self::from_single_graph(SingleModuleGraph::new_with_entries(
Vc::cell(vec![ChunkGroupEntry::Entry(vec![module])]), Vc::cell(vec![ChunkGroupEntry::Entry(vec![module])]),
include_traced, include_traced,
include_binding_usage,
)) ))
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn from_modules(modules: Vc<GraphEntries>, include_traced: bool) -> Vc<Self> { pub fn from_modules(
Self::from_single_graph(SingleModuleGraph::new_with_entries(modules, include_traced)) modules: Vc<GraphEntries>,
include_traced: bool,
include_binding_usage: bool,
) -> Vc<Self> {
Self::from_single_graph(SingleModuleGraph::new_with_entries(
modules,
include_traced,
include_binding_usage,
))
} }
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -1534,8 +1546,15 @@ impl SingleModuleGraph { ...@@ -1534,8 +1546,15 @@ impl SingleModuleGraph {
pub async fn new_with_entries( pub async fn new_with_entries(
entries: Vc<GraphEntries>, entries: Vc<GraphEntries>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<Self>> { ) -> Result<Vc<Self>> {
SingleModuleGraph::new_inner(&*entries.await?, &Default::default(), include_traced).await SingleModuleGraph::new_inner(
&*entries.await?,
&Default::default(),
include_traced,
include_binding_usage,
)
.await
} }
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -1543,11 +1562,13 @@ impl SingleModuleGraph { ...@@ -1543,11 +1562,13 @@ impl SingleModuleGraph {
entries: Vc<GraphEntries>, entries: Vc<GraphEntries>,
visited_modules: Vc<VisitedModules>, visited_modules: Vc<VisitedModules>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<Self>> { ) -> Result<Vc<Self>> {
SingleModuleGraph::new_inner( SingleModuleGraph::new_inner(
&*entries.await?, &*entries.await?,
&visited_modules.await?.modules, &visited_modules.await?.modules,
include_traced, include_traced,
include_binding_usage,
) )
.await .await
} }
...@@ -1558,9 +1579,15 @@ impl SingleModuleGraph { ...@@ -1558,9 +1579,15 @@ impl SingleModuleGraph {
entries: GraphEntriesT, entries: GraphEntriesT,
visited_modules: Vc<VisitedModules>, visited_modules: Vc<VisitedModules>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<Self>> { ) -> Result<Vc<Self>> {
SingleModuleGraph::new_inner(&entries, &visited_modules.await?.modules, include_traced) SingleModuleGraph::new_inner(
.await &entries,
&visited_modules.await?.modules,
include_traced,
include_binding_usage,
)
.await
} }
} }
...@@ -1689,6 +1716,9 @@ struct SingleModuleGraphBuilder<'a> { ...@@ -1689,6 +1716,9 @@ struct SingleModuleGraphBuilder<'a> {
/// Whether to walk ChunkingType::Traced references /// Whether to walk ChunkingType::Traced references
include_traced: bool, include_traced: bool,
/// Whether to read ChunkableModuleReference::binding_usage()
include_binding_usage: bool,
} }
impl impl
Visit<( Visit<(
...@@ -1753,10 +1783,15 @@ impl ...@@ -1753,10 +1783,15 @@ impl
let visited_modules = self.visited_modules; let visited_modules = self.visited_modules;
let emit_spans = self.emit_spans; let emit_spans = self.emit_spans;
let include_traced = self.include_traced; let include_traced = self.include_traced;
let include_binding_usage = self.include_binding_usage;
async move { async move {
Ok(match (module, chunkable_ref_target) { Ok(match (module, chunkable_ref_target) {
(Some(module), None) => { (Some(module), None) => {
let refs_cell = primary_chunkable_referenced_modules(*module, include_traced); let refs_cell = primary_chunkable_referenced_modules(
*module,
include_traced,
include_binding_usage,
);
let refs = match refs_cell.await { let refs = match refs_cell.await {
Ok(refs) => refs, Ok(refs) => refs,
Err(e) => { Err(e) => {
...@@ -2107,6 +2142,7 @@ pub mod tests { ...@@ -2107,6 +2142,7 @@ pub mod tests {
let parent_graph = SingleModuleGraph::new_with_entries( let parent_graph = SingleModuleGraph::new_with_entries(
GraphEntries::cell(GraphEntries(vec![ChunkGroupEntry::Entry(vec![b_module])])), GraphEntries::cell(GraphEntries(vec![ChunkGroupEntry::Entry(vec![b_module])])),
false, false,
false,
); );
let module_graph = ModuleGraph::from_graphs(vec![ let module_graph = ModuleGraph::from_graphs(vec![
...@@ -2115,6 +2151,7 @@ pub mod tests { ...@@ -2115,6 +2151,7 @@ pub mod tests {
GraphEntries::cell(GraphEntries(vec![ChunkGroupEntry::Entry(vec![a_module])])), GraphEntries::cell(GraphEntries(vec![ChunkGroupEntry::Entry(vec![a_module])])),
VisitedModules::from_graph(parent_graph), VisitedModules::from_graph(parent_graph),
false, false,
false,
), ),
]) ])
.await?; .await?;
...@@ -2340,6 +2377,7 @@ pub mod tests { ...@@ -2340,6 +2377,7 @@ pub mod tests {
entry_modules.clone(), entry_modules.clone(),
)])), )])),
false, false,
false,
); );
// Create a simple name mapping to make analyzing the visitors easier. // Create a simple name mapping to make analyzing the visitors easier.
......
...@@ -314,6 +314,7 @@ pub struct ModulesWithRefData(Vec<(ResolvedVc<Box<dyn ModuleReference>>, Resolve ...@@ -314,6 +314,7 @@ pub struct ModulesWithRefData(Vec<(ResolvedVc<Box<dyn ModuleReference>>, Resolve
pub async fn primary_chunkable_referenced_modules( pub async fn primary_chunkable_referenced_modules(
module: ResolvedVc<Box<dyn Module>>, module: ResolvedVc<Box<dyn Module>>,
include_traced: bool, include_traced: bool,
include_binding_usage: bool,
) -> Result<Vc<ModulesWithRefData>> { ) -> Result<Vc<ModulesWithRefData>> {
let modules = module let modules = module
.references() .references()
...@@ -333,7 +334,11 @@ pub async fn primary_chunkable_referenced_modules( ...@@ -333,7 +334,11 @@ pub async fn primary_chunkable_referenced_modules(
.await? .await?
.primary_modules_ref() .primary_modules_ref()
.await?; .await?;
let binding_usage = reference.binding_usage().owned().await?; let binding_usage = if include_binding_usage {
reference.binding_usage().owned().await?
} else {
BindingUsage::default()
};
return Ok(Some(( return Ok(Some((
ResolvedVc::upcast(reference), ResolvedVc::upcast(reference),
......
...@@ -499,7 +499,7 @@ impl PostCssTransformedAsset { ...@@ -499,7 +499,7 @@ impl PostCssTransformedAsset {
.to_resolved() .to_resolved()
.await?; .await?;
let module_graph = ModuleGraph::from_modules(entries.graph_entries(), false) let module_graph = ModuleGraph::from_modules(entries.graph_entries(), false, false)
.to_resolved() .to_resolved()
.await?; .await?;
......
...@@ -245,7 +245,7 @@ impl WebpackLoadersProcessedAsset { ...@@ -245,7 +245,7 @@ impl WebpackLoadersProcessedAsset {
.to_resolved() .to_resolved()
.await?; .await?;
let module_graph = ModuleGraph::from_modules(entries.graph_entries(), false) let module_graph = ModuleGraph::from_modules(entries.graph_entries(), false, false)
.to_resolved() .to_resolved()
.await?; .await?;
......
...@@ -476,7 +476,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V ...@@ -476,7 +476,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V
let entries = get_evaluate_entries(jest_entry_asset, asset_context, None); let entries = get_evaluate_entries(jest_entry_asset, asset_context, None);
let mut module_graph = ModuleGraph::from_modules(entries.graph_entries(), false); let mut module_graph = ModuleGraph::from_modules(entries.graph_entries(), false, true);
let binding_usage = if options.remove_unused_imports || options.remove_unused_exports { let binding_usage = if options.remove_unused_imports || options.remove_unused_exports {
Some( Some(
......
...@@ -432,6 +432,7 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> { ...@@ -432,6 +432,7 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> {
let mut module_graph = ModuleGraph::from_modules( let mut module_graph = ModuleGraph::from_modules(
Vc::cell(vec![ChunkGroupEntry::Entry(entry_modules.clone())]), Vc::cell(vec![ChunkGroupEntry::Entry(entry_modules.clone())]),
false, false,
true,
); );
let binding_usage = if options.remove_unused_imports || options.remove_unused_exports { let binding_usage = if options.remove_unused_imports || options.remove_unused_exports {
......
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