Skip to content

Commit

Permalink
fix: not duplicate set resolve.alias (#1948)
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 authored Jan 15, 2024
1 parent cf8634d commit 1147f48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-fans-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/enhanced': patch
---

fix: not duplicate set resolve.alias
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,22 @@ class FederationRuntimePlugin {
paths: [this.options.implementation],
});
}
if (Array.isArray(compiler.options.resolve.alias)) {
return;
}

compiler.options.resolve.alias = {
...compiler.options.resolve.alias,
'@module-federation/runtime$': runtimePath,
'@module-federation/runtime-tools$':
this.options?.implementation || RuntimeToolsPath,
};

if (!compiler.options.resolve.alias['@module-federation/runtime$']) {
compiler.options.resolve.alias['@module-federation/runtime$'] =
runtimePath;
}
if (!compiler.options.resolve.alias['@module-federation/runtime-tools$']) {
compiler.options.resolve.alias['@module-federation/runtime-tools$'] =
this.options?.implementation || RuntimeToolsPath;
}
}

apply(compiler: Compiler) {
Expand Down

0 comments on commit 1147f48

Please sign in to comment.