From cfe7ff69c34548291598897bdff160ece7b5f249 Mon Sep 17 00:00:00 2001 From: LichuAcu Date: Thu, 22 Aug 2024 14:31:51 -0700 Subject: [PATCH] Fix async dynamic client modules in graph traversal --- .../src/global_module_id_strategy.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/turbopack/crates/turbopack-ecmascript/src/global_module_id_strategy.rs b/turbopack/crates/turbopack-ecmascript/src/global_module_id_strategy.rs index 2404abfda8681b..7879af967c9211 100644 --- a/turbopack/crates/turbopack-ecmascript/src/global_module_id_strategy.rs +++ b/turbopack/crates/turbopack-ecmascript/src/global_module_id_strategy.rs @@ -145,12 +145,19 @@ pub async fn children_modules_idents( modules_idents.insert(ident_str, hash); } ReferencedModule::AsyncLoaderModule(async_loader_module) => { - let async_loader_ident = async_loader_module + let loader_ident = async_loader_module .ident() .with_modifier(Vc::cell("async loader".into())); - let ident_str = async_loader_ident.to_string().await?.clone_value(); - let hash = hash_xxh3_hash64(&ident_str); - modules_idents.insert(ident_str, hash); + let loader_ident_str = loader_ident.to_string().await?.clone_value(); + let loader_hash = hash_xxh3_hash64(&loader_ident_str); + modules_idents.insert(loader_ident_str, loader_hash); + + let loaded_client_ident = async_loader_module + .ident() + .with_layer(Vc::cell("app-client".into())); + let loaded_client_ident_str = loaded_client_ident.to_string().await?.clone_value(); + let loaded_client_hash = hash_xxh3_hash64(&loaded_client_ident_str); + modules_idents.insert(loaded_client_ident_str, loaded_client_hash); } } }