@@ -5,7 +5,7 @@ import type {
5
5
ManifestModuleInfos ,
6
6
moduleFederationPlugin ,
7
7
} from '@module-federation/sdk' ;
8
- import { getBuildVersion , parseOptions } from './utils' ;
8
+ import { parseOptions } from './utils' ;
9
9
import type { EntryObject } from 'webpack' ;
10
10
import { BasicPluginOptionsManager } from './BasicPluginOptionsManager' ;
11
11
@@ -65,7 +65,7 @@ class ContainerManager extends BasicPluginOptionsManager<moduleFederationPlugin.
65
65
const [ exposeKey , exposeObj ] = item ;
66
66
sum [ exposeKey ] = exposeObj ;
67
67
return sum ;
68
- } , { } ) ;
68
+ } , { } as moduleFederationPlugin . ExposesObject ) ;
69
69
}
70
70
// { '.' : './src/Button.jsx' } => { '__federation_expose_Component' : ['src/Buttton'] }
71
71
get exposeFileNameImportMap ( ) : Record < string , string [ ] > {
@@ -81,30 +81,36 @@ class ContainerManager extends BasicPluginOptionsManager<moduleFederationPlugin.
81
81
name : item . name || generateExposeFilename ( key , false ) ,
82
82
} ) ,
83
83
) ;
84
- return parsedOptions . reduce ( ( sum , item ) => {
85
- const [ _exposeKey , exposeObj ] = item ;
86
- const { name, import : importPath } = exposeObj ;
87
- sum [ name ] = importPath ;
88
- return sum ;
89
- } , { } ) ;
84
+ return parsedOptions . reduce (
85
+ ( sum , item ) => {
86
+ const [ _exposeKey , exposeObj ] = item ;
87
+ const { name, import : importPath } = exposeObj ;
88
+ sum [ name ] = importPath ;
89
+ return sum ;
90
+ } ,
91
+ { } as Record < string , string [ ] > ,
92
+ ) ;
90
93
}
91
94
92
95
// { '.' : './src/Button.jsx' } => { '.' : ['src/Button'] }
93
- get exposeObject ( ) : Record < string , string > {
96
+ get exposeObject ( ) : Record < string , string [ ] > {
94
97
const parsedOptions = this . _parseOptions ( ) ;
95
98
96
- return parsedOptions . reduce ( ( sum , item ) => {
97
- const [ exposeKey , exposeObject ] = item ;
98
- sum [ exposeKey ] = [ ] ;
99
- exposeObject . import . forEach ( ( item ) => {
100
- const relativePath = path . relative (
101
- '.' ,
102
- item . replace ( path . extname ( item ) , '' ) ,
103
- ) ;
104
- sum [ exposeKey ] . push ( relativePath ) ;
105
- } ) ;
106
- return sum ;
107
- } , { } ) ;
99
+ return parsedOptions . reduce (
100
+ ( sum , item ) => {
101
+ const [ exposeKey , exposeObject ] = item ;
102
+ sum [ exposeKey ] = [ ] ;
103
+ exposeObject . import . forEach ( ( item ) => {
104
+ const relativePath = path . relative (
105
+ '.' ,
106
+ item . replace ( path . extname ( item ) , '' ) ,
107
+ ) ;
108
+ sum [ exposeKey ] . push ( relativePath ) ;
109
+ } ) ;
110
+ return sum ;
111
+ } ,
112
+ { } as Record < string , string [ ] > ,
113
+ ) ;
108
114
}
109
115
110
116
// { '.' : './src/Button.jsx' } => ['./src/Button.jsx']
0 commit comments