@@ -5,58 +5,27 @@ import type {
55 WebpackPluginInstance ,
66 Module ,
77 Dependency ,
8- NormalModule as NormalModuleType ,
98} from 'webpack' ;
109import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path' ;
11- import type { RuntimeSpec } from 'webpack/lib/util/runtime' ;
12- import type ExportsInfo from 'webpack/lib/ExportsInfo' ;
13- import ContainerEntryModule from './ContainerEntryModule' ;
14- import { moduleFederationPlugin } from '@module-federation/sdk' ;
1510import FederationModulesPlugin from './runtime/FederationModulesPlugin' ;
1611import ContainerEntryDependency from './ContainerEntryDependency' ;
1712import FederationRuntimeDependency from './runtime/FederationRuntimeDependency' ;
18- import RemoteToExternalDependency from './RemoteToExternalDependency' ;
19- import RemoteModule from './RemoteModule' ;
2013
21- const { NormalModule , AsyncDependenciesBlock, ExternalModule } = require (
14+ const { AsyncDependenciesBlock, ExternalModule } = require (
2215 normalizeWebpackPath ( 'webpack' ) ,
2316) as typeof import ( 'webpack' ) ;
24- const ConcatenatedModule = require (
25- normalizeWebpackPath ( 'webpack/lib/optimize/ConcatenatedModule' ) ,
26- ) as typeof import ( 'webpack/lib/optimize/ConcatenatedModule' ) ;
2717
2818const PLUGIN_NAME = 'HoistContainerReferences' ;
2919
3020/**
3121 * This class is used to hoist container references in the code.
3222 */
3323export class HoistContainerReferences implements WebpackPluginInstance {
34- private readonly containerName : string ;
35- private readonly entryFilePath ?: string ;
36- private readonly bundlerRuntimeDep ?: string ;
37- private readonly explanation : string ;
38- private readonly experiments : moduleFederationPlugin . ModuleFederationPluginOptions [ 'experiments' ] ;
39-
40- constructor (
41- name ?: string ,
42- entryFilePath ?: string ,
43- bundlerRuntimeDep ?: string ,
44- experiments ?: moduleFederationPlugin . ModuleFederationPluginOptions [ 'experiments' ] ,
45- ) {
46- this . containerName = name || 'no known chunk name' ;
47- this . entryFilePath = entryFilePath ;
48- this . bundlerRuntimeDep = bundlerRuntimeDep ;
49- this . experiments = experiments ;
50- this . explanation =
51- 'Bundler runtime path module is required for proper functioning' ;
52- }
53-
5424 apply ( compiler : Compiler ) : void {
5525 compiler . hooks . thisCompilation . tap (
5626 PLUGIN_NAME ,
5727 ( compilation : Compilation ) => {
5828 const logger = compilation . getLogger ( PLUGIN_NAME ) ;
59- const { chunkGraph, moduleGraph } = compilation ;
6029 const hooks = FederationModulesPlugin . getCompilationHooks ( compilation ) ;
6130 const containerEntryDependencies = new Set < Dependency > ( ) ;
6231 hooks . addContainerEntryModule . tap (
0 commit comments