Skip to content

Commit 9630d07

Browse files
fix(mf): preserve aliased remote manifest lookups
1 parent 7fbcf76 commit 9630d07

File tree

2 files changed

+5
-6
lines changed
  • crates/rspack_plugin_mf/src/manifest
  • tests/rspack-test/configCases/container-1-5/manifest-rsc-references

2 files changed

+5
-6
lines changed

crates/rspack_plugin_mf/src/manifest/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ async fn process_assets(&self, compilation: &mut Compilation) -> Result<()> {
774774
trimmed.to_string()
775775
}
776776
};
777-
let (entry, federation_container_name) =
777+
let (entry, federation_container_name, lookup_remote_name) =
778778
if let Some(target) = provided_remote_alias_map.get(&alias) {
779779
let remote_container_name = if target.name.is_empty() {
780780
alias.clone()
@@ -784,9 +784,10 @@ async fn process_assets(&self, compilation: &mut Compilation) -> Result<()> {
784784
(
785785
target.entry.clone().filter(|entry| !entry.is_empty()),
786786
remote_container_name,
787+
alias.clone(),
787788
)
788789
} else {
789-
(None, alias.clone())
790+
(None, alias.clone(), alias.clone())
790791
};
791792
let used_in =
792793
collect_usage_files_for_module(compilation, module_graph, &module_id, &entry_point_names)
@@ -811,7 +812,7 @@ async fn process_assets(&self, compilation: &mut Compilation) -> Result<()> {
811812
}
812813
let rsc = build_rsc_reference_meta_from_modules(
813814
compilation,
814-
compose_remote_lookup(&alias, &module_name),
815+
compose_remote_lookup(&lookup_remote_name, &module_name),
815816
remote_usage_module_ids.into_iter(),
816817
);
817818
remote_list.push(StatsRemote {

tests/rspack-test/configCases/container-1-5/manifest-rsc-references/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ it("should capture RSC references for shared modules by package key", () => {
1212
expect(shared.shareKey).toBe("rsc-shared-key");
1313
expect(shared.rsc).toBeDefined();
1414
expect(shared.rsc.lookup).toBe(shared.shareKey);
15-
expect(shared.usedIn).toEqual(
16-
expect.arrayContaining(["exposed-client.js", "rsc-consumer.js"])
17-
);
15+
expect(shared.usedIn).toContain("rsc-consumer.js");
1816
expect(shared.rsc.moduleType).toBe("client");
1917
expect(shared.rsc.clientReferences).toEqual(
2018
expect.arrayContaining(["SharedClientComponent", "sharedAction", "sharedValue"])

0 commit comments

Comments
 (0)