Skip to content

Commit 231f965

Browse files
Share flalback (#3893)
Co-authored-by: Claude <[email protected]>
1 parent 0859e65 commit 231f965

File tree

4 files changed

+35
-317
lines changed

4 files changed

+35
-317
lines changed

apps/3000-home/package.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,9 @@
1111
"react-dom": "19.0.0"
1212
},
1313
"devDependencies": {
14-
<<<<<<< HEAD
1514
"@module-federation/nextjs-mf": "workspace:*",
16-
<<<<<<< HEAD
17-
"@module-federation/runtime": "workspace:*",
18-
"@types/react": "18.3.11",
19-
"@types/react-dom": "18.3.0",
20-
"webpack": "5.98.0"
21-
=======
22-
"@module-federation/runtime": "workspace:*"
23-
>>>>>>> e644b8fe8 (chore: update cmd syntax exit)
24-
=======
25-
"@module-federation/nextjs-mf": "0.0.0-next-20250701105507",
2615
"@module-federation/runtime": "workspace:*",
2716
"webpack": "^5.98.0"
28-
>>>>>>> 2a2337ae2 (feat: merge increment C - core package dependencies)
2917
},
3018
"scripts": {
3119
"start": "next start",

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

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,13 @@ class ConsumeSharedPlugin {
492492
}
493493
const { context, request, contextInfo } = resolveData;
494494

495-
const match = unresolvedConsumes.get(
496-
createLookupKeyForSharing(request, contextInfo.issuerLayer),
497-
);
495+
const match =
496+
unresolvedConsumes.get(
497+
createLookupKeyForSharing(request, contextInfo.issuerLayer),
498+
) ||
499+
unresolvedConsumes.get(
500+
createLookupKeyForSharing(request, undefined),
501+
);
498502

499503
// First check direct match with original request
500504
if (match !== undefined) {
@@ -522,12 +526,19 @@ class ConsumeSharedPlugin {
522526

523527
// Try to match with module path after node_modules
524528
if (modulePathAfterNodeModules) {
525-
const moduleMatch = unresolvedConsumes.get(
526-
createLookupKeyForSharing(
527-
modulePathAfterNodeModules,
528-
contextInfo.issuerLayer,
529-
),
530-
);
529+
const moduleMatch =
530+
unresolvedConsumes.get(
531+
createLookupKeyForSharing(
532+
modulePathAfterNodeModules,
533+
contextInfo.issuerLayer,
534+
),
535+
) ||
536+
unresolvedConsumes.get(
537+
createLookupKeyForSharing(
538+
modulePathAfterNodeModules,
539+
undefined,
540+
),
541+
);
531542

532543
if (
533544
moduleMatch !== undefined &&
@@ -543,12 +554,16 @@ class ConsumeSharedPlugin {
543554
}
544555

545556
// Try to match with the full reconstructed path
546-
const reconstructedMatch = unresolvedConsumes.get(
547-
createLookupKeyForSharing(
548-
reconstructed,
549-
contextInfo.issuerLayer,
550-
),
551-
);
557+
const reconstructedMatch =
558+
unresolvedConsumes.get(
559+
createLookupKeyForSharing(
560+
reconstructed,
561+
contextInfo.issuerLayer,
562+
),
563+
) ||
564+
unresolvedConsumes.get(
565+
createLookupKeyForSharing(reconstructed, undefined),
566+
);
552567

553568
if (reconstructedMatch !== undefined) {
554569
return boundCreateConsumeSharedModule(

packages/managers/__tests__/__snapshots__/SharedManager.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ exports[`SharedManager normalizedOptions 1`] = `
77
"requiredVersion": "^18.0.0",
88
"shareScope": "default",
99
"singleton": false,
10-
"version": "19.0.0",
10+
"version": "18.3.1",
1111
}
1212
`;

0 commit comments

Comments
 (0)