Skip to content

Commit 1f3950a

Browse files
feat: add missing remote dependency hook calls to RemoteModule
- Add addRemoteDependency hook calls in RemoteModule.ts build method - Ensures HoistContainerReferencesPlugin can properly track remote dependencies - Calls hook for both RemoteToExternalDependency and FallbackDependency - Brings current branch in sync with share-filter branch hook implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a8efcfd commit 1f3950a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/enhanced/src/lib/container/RemoteModule.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type { ResolverWithOptions } from 'webpack/lib/ResolverFactory';
1818
import type { InputFileSystem } from 'webpack/lib/FileSystemInfo';
1919
import type { RequestShortener } from 'webpack/lib/RuntimeModule';
2020
import type { ObjectDeserializerContext } from 'webpack/lib/serialization/ObjectMiddleware';
21+
import FederationModulesPlugin from './runtime/FederationModulesPlugin';
2122

2223
const { sources: webpackSources } = require(
2324
normalizeWebpackPath('webpack'),
@@ -124,11 +125,15 @@ class RemoteModule extends Module {
124125

125126
this.clearDependenciesAndBlocks();
126127
if (this.externalRequests.length === 1) {
127-
this.addDependency(
128-
new RemoteToExternalDependency(this.externalRequests[0]),
129-
);
128+
const dep = new RemoteToExternalDependency(this.externalRequests[0]);
129+
this.addDependency(dep);
130+
const hooks = FederationModulesPlugin.getCompilationHooks(compilation);
131+
hooks.addRemoteDependency.call(dep);
130132
} else {
131-
this.addDependency(new FallbackDependency(this.externalRequests));
133+
const dep = new FallbackDependency(this.externalRequests);
134+
this.addDependency(dep);
135+
const hooks = FederationModulesPlugin.getCompilationHooks(compilation);
136+
hooks.addRemoteDependency.call(dep);
132137
}
133138

134139
callback();

0 commit comments

Comments
 (0)