Skip to content

Commit 1147f48

Browse files
authored
fix: not duplicate set resolve.alias (#1948)
1 parent cf8634d commit 1147f48

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.changeset/lemon-fans-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/enhanced': patch
3+
---
4+
5+
fix: not duplicate set resolve.alias

packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,22 @@ class FederationRuntimePlugin {
205205
paths: [this.options.implementation],
206206
});
207207
}
208+
if (Array.isArray(compiler.options.resolve.alias)) {
209+
return;
210+
}
208211

209212
compiler.options.resolve.alias = {
210213
...compiler.options.resolve.alias,
211-
'@module-federation/runtime$': runtimePath,
212-
'@module-federation/runtime-tools$':
213-
this.options?.implementation || RuntimeToolsPath,
214214
};
215+
216+
if (!compiler.options.resolve.alias['@module-federation/runtime$']) {
217+
compiler.options.resolve.alias['@module-federation/runtime$'] =
218+
runtimePath;
219+
}
220+
if (!compiler.options.resolve.alias['@module-federation/runtime-tools$']) {
221+
compiler.options.resolve.alias['@module-federation/runtime-tools$'] =
222+
this.options?.implementation || RuntimeToolsPath;
223+
}
215224
}
216225

217226
apply(compiler: Compiler) {

0 commit comments

Comments
 (0)