Skip to content

Commit b61d776

Browse files
Share flalback (#3893)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 32a4f14 commit b61d776

File tree

6 files changed

+1320
-316
lines changed

6 files changed

+1320
-316
lines changed

apps/3000-home/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"react-dom": "19.0.0"
1212
},
1313
"devDependencies": {
14-
"@module-federation/nextjs-mf": "0.0.0-next-20250701105507",
14+
"@module-federation/nextjs-mf": "workspace:*",
1515
"@module-federation/runtime": "workspace:*",
1616
"webpack": "^5.98.0"
1717
},

packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,13 @@ class ConsumeSharedPlugin {
481481
}
482482
const { context, request, contextInfo } = resolveData;
483483

484-
const match = unresolvedConsumes.get(
485-
createLookupKeyForSharing(request, contextInfo.issuerLayer),
486-
);
484+
const match =
485+
unresolvedConsumes.get(
486+
createLookupKeyForSharing(request, contextInfo.issuerLayer),
487+
) ||
488+
unresolvedConsumes.get(
489+
createLookupKeyForSharing(request, undefined),
490+
);
487491

488492
// First check direct match with original request
489493
if (match !== undefined) {
@@ -511,12 +515,19 @@ class ConsumeSharedPlugin {
511515

512516
// Try to match with module path after node_modules
513517
if (modulePathAfterNodeModules) {
514-
const moduleMatch = unresolvedConsumes.get(
515-
createLookupKeyForSharing(
516-
modulePathAfterNodeModules,
517-
contextInfo.issuerLayer,
518-
),
519-
);
518+
const moduleMatch =
519+
unresolvedConsumes.get(
520+
createLookupKeyForSharing(
521+
modulePathAfterNodeModules,
522+
contextInfo.issuerLayer,
523+
),
524+
) ||
525+
unresolvedConsumes.get(
526+
createLookupKeyForSharing(
527+
modulePathAfterNodeModules,
528+
undefined,
529+
),
530+
);
520531

521532
if (
522533
moduleMatch !== undefined &&
@@ -532,12 +543,16 @@ class ConsumeSharedPlugin {
532543
}
533544

534545
// Try to match with the full reconstructed path
535-
const reconstructedMatch = unresolvedConsumes.get(
536-
createLookupKeyForSharing(
537-
reconstructed,
538-
contextInfo.issuerLayer,
539-
),
540-
);
546+
const reconstructedMatch =
547+
unresolvedConsumes.get(
548+
createLookupKeyForSharing(
549+
reconstructed,
550+
contextInfo.issuerLayer,
551+
),
552+
) ||
553+
unresolvedConsumes.get(
554+
createLookupKeyForSharing(reconstructed, undefined),
555+
);
541556

542557
if (reconstructedMatch !== undefined) {
543558
return boundCreateConsumeSharedModule(

0 commit comments

Comments
 (0)