Skip to content

Commit 0f4d9e2

Browse files
fix(nextjs-mf): do not crash if host is not next (#2604)
Co-authored-by: ScriptedAlchemy <[email protected]>
1 parent 4a2df4f commit 0f4d9e2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changeset/ten-apples-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/nextjs-mf': patch
3+
---
4+
5+
Do not crash on share resolver if host is not next

packages/nextjs-mf/src/plugins/container/runtimePlugin.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ export default function (): FederationRuntimePlugin {
177177
if (!host) {
178178
return args;
179179
}
180+
181+
if (!host.options.shared[pkgName]) {
182+
return args;
183+
}
184+
180185
args.resolver = function () {
181186
shareScopeMap[scope][pkgName][version] =
182187
host.options.shared[pkgName][0]; // replace local share scope manually with desired module

0 commit comments

Comments
 (0)