Skip to content

Commit 86b4cdc

Browse files
authored
fix(rspack): only patchChunkSplit when config set exposes (#3095)
1 parent 837da81 commit 86b4cdc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.changeset/tricky-sheep-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/rspack': patch
3+
---
4+
5+
fix(rspack): only patchChunkSplit when config set exposes

packages/rspack/src/ModuleFederationPlugin.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ export class ModuleFederationPlugin implements RspackPluginInstance {
6767
}
6868
this._checkSingleton(compiler);
6969
this._patchBundlerConfig(compiler);
70-
this._patchChunkSplit(compiler, options.name);
70+
const containerManager = new ContainerManager();
71+
containerManager.init(options);
72+
73+
if (containerManager.enable) {
74+
this._patchChunkSplit(compiler, options.name);
75+
}
7176

7277
options.implementation = options.implementation || RuntimeToolsPath;
7378
let disableManifest = options.manifest === false;
@@ -79,8 +84,6 @@ export class ModuleFederationPlugin implements RspackPluginInstance {
7984
}
8085
if (!disableManifest && options.exposes) {
8186
try {
82-
const containerManager = new ContainerManager();
83-
containerManager.init(options);
8487
options.exposes = containerManager.containerPluginExposesOptions;
8588
} catch (err) {
8689
if (err instanceof Error) {

0 commit comments

Comments
 (0)