@@ -5,58 +5,27 @@ import type {
5
5
WebpackPluginInstance ,
6
6
Module ,
7
7
Dependency ,
8
- NormalModule as NormalModuleType ,
9
8
} from 'webpack' ;
10
9
import { 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' ;
15
10
import FederationModulesPlugin from './runtime/FederationModulesPlugin' ;
16
11
import ContainerEntryDependency from './ContainerEntryDependency' ;
17
12
import FederationRuntimeDependency from './runtime/FederationRuntimeDependency' ;
18
- import RemoteToExternalDependency from './RemoteToExternalDependency' ;
19
- import RemoteModule from './RemoteModule' ;
20
13
21
- const { NormalModule , AsyncDependenciesBlock, ExternalModule } = require (
14
+ const { AsyncDependenciesBlock, ExternalModule } = require (
22
15
normalizeWebpackPath ( 'webpack' ) ,
23
16
) as typeof import ( 'webpack' ) ;
24
- const ConcatenatedModule = require (
25
- normalizeWebpackPath ( 'webpack/lib/optimize/ConcatenatedModule' ) ,
26
- ) as typeof import ( 'webpack/lib/optimize/ConcatenatedModule' ) ;
27
17
28
18
const PLUGIN_NAME = 'HoistContainerReferences' ;
29
19
30
20
/**
31
21
* This class is used to hoist container references in the code.
32
22
*/
33
23
export 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
-
54
24
apply ( compiler : Compiler ) : void {
55
25
compiler . hooks . thisCompilation . tap (
56
26
PLUGIN_NAME ,
57
27
( compilation : Compilation ) => {
58
28
const logger = compilation . getLogger ( PLUGIN_NAME ) ;
59
- const { chunkGraph, moduleGraph } = compilation ;
60
29
const hooks = FederationModulesPlugin . getCompilationHooks ( compilation ) ;
61
30
const containerEntryDependencies = new Set < Dependency > ( ) ;
62
31
hooks . addContainerEntryModule . tap (
0 commit comments