Skip to content

Commit

Permalink
fix(enhanced): only apply ModuleFederationPlugin once
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 committed Jan 8, 2025
1 parent f773237 commit da84187
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-clocks-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/enhanced': patch
---

fix(enhanced): only apply ModuleFederationPlugin once
6 changes: 4 additions & 2 deletions packages/enhanced/src/wrapper/ModuleFederationPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ export default class ModuleFederationPlugin implements WebpackPluginInstance {

apply(compiler: Compiler) {
if (
!compiler.options.plugins.find(
compiler.options.plugins.find(
(p: WebpackPluginInstance | WebpackPluginFunction | Falsy) =>
p && (p as WebpackPluginInstance)['name'] === PLUGIN_NAME,
)
) {
compiler.options.plugins.push(this);
return;
}
compiler.options.plugins.push(this);

process.env['FEDERATION_WEBPACK_PATH'] =
process.env['FEDERATION_WEBPACK_PATH'] || getWebpackPath(compiler);
const CoreModuleFederationPlugin =
Expand Down

0 comments on commit da84187

Please sign in to comment.