From 3a6a203eb2fd46fbd1374d7dc521c91828f99f91 Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 19 Jan 2024 17:11:31 +0800 Subject: [PATCH] fix: avoid shared module will be compiled in wrong target compiler --- .changeset/dirty-mayflies-bake.md | 5 +++++ packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/dirty-mayflies-bake.md diff --git a/.changeset/dirty-mayflies-bake.md b/.changeset/dirty-mayflies-bake.md new file mode 100644 index 0000000000..ae405018ef --- /dev/null +++ b/.changeset/dirty-mayflies-bake.md @@ -0,0 +1,5 @@ +--- +'@module-federation/enhanced': patch +--- + +fix: avoid shared module will be compiled in wrong target compiler diff --git a/packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts b/packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts index c66223dec4..06dfcdb535 100644 --- a/packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts +++ b/packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts @@ -113,7 +113,7 @@ class ProvideSharedPlugin { const compilationData: WeakMap = new WeakMap(); - compiler.hooks.compilation.tap( + compiler.hooks.thisCompilation.tap( 'ProvideSharedPlugin', (compilation: Compilation, { normalModuleFactory }) => { const resolvedProvideMap: ResolvedProvideMap = new Map(); @@ -254,7 +254,7 @@ class ProvideSharedPlugin { }, ); - compiler.hooks.compilation.tap( + compiler.hooks.thisCompilation.tap( 'ProvideSharedPlugin', (compilation: Compilation, { normalModuleFactory }) => { compilation.dependencyFactories.set(