Skip to content

Commit 0ab51b8

Browse files
xinyuehtxcanxingScriptedAlchemy2heal1
authored
fix(enhanced): add module factory for EntryDependency when entry is e… (#3953)
Co-authored-by: canxing <[email protected]> Co-authored-by: Zack Jackson <[email protected]> Co-authored-by: Hanric <[email protected]>
1 parent f6381e6 commit 0ab51b8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.changeset/chatty-mangos-play.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@module-federation/enhanced': minor
3+
---
4+
5+
fix(enhanced): add module factory for EntryDependency when entry is empty
6+
7+
- bind normalModuleFactory for EntryDependency when no moduleFactory is bound for EntryDependency

packages/enhanced/src/lib/container/ContainerPlugin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const ModuleDependency = require(
2727
normalizeWebpackPath('webpack/lib/dependencies/ModuleDependency'),
2828
) as typeof import('webpack/lib/dependencies/ModuleDependency');
2929

30+
const EntryDependency = require(
31+
normalizeWebpackPath('webpack/lib/dependencies/EntryDependency'),
32+
) as typeof import('webpack/lib/dependencies/EntryDependency');
33+
3034
const createSchemaValidation = require(
3135
normalizeWebpackPath('webpack/lib/util/create-schema-validation'),
3236
) as typeof import('webpack/lib/util/create-schema-validation');
@@ -311,6 +315,13 @@ class ContainerPlugin {
311315
ContainerExposedDependency,
312316
normalModuleFactory,
313317
);
318+
319+
if (!compilation.dependencyFactories.has(EntryDependency)) {
320+
compilation.dependencyFactories.set(
321+
EntryDependency,
322+
normalModuleFactory,
323+
);
324+
}
314325
},
315326
);
316327

0 commit comments

Comments
 (0)