@@ -182,69 +182,71 @@ class ContainerPlugin {
182
182
compiler . options . output . enabledLibraryTypes . push ( library . type ) ;
183
183
}
184
184
185
- compiler . hooks . make . tapAsync ( PLUGIN_NAME , ( compilation , callback ) => {
186
- const dep = new ContainerEntryDependency (
187
- name ,
188
- //@ts -ignore
189
- exposes ,
190
- shareScope ,
191
- federationRuntimePluginInstance . entryFilePath ,
192
- ) ;
193
- const hasSingleRuntimeChunk =
194
- compilation . options ?. optimization ?. runtimeChunk ;
195
- dep . loc = { name } ;
196
- compilation . addEntry (
197
- compilation . options . context || '' ,
198
- //@ts -ignore
199
- dep ,
200
- {
185
+ compiler . hooks . make . tapAsync (
186
+ PLUGIN_NAME ,
187
+ (
188
+ compilation : Compilation ,
189
+ callback : ( error ?: WebpackError | null | undefined ) => void ,
190
+ ) => {
191
+ const dep = new ContainerEntryDependency (
201
192
name ,
202
- filename,
203
- runtime : hasSingleRuntimeChunk ? false : runtime ,
204
- library,
205
- } ,
206
- ( error : WebpackError | null | undefined ) => {
207
- if ( error ) return callback ( error ) ;
208
- if ( hasSingleRuntimeChunk ) {
209
- // Add to single runtime chunk as well.
210
- // Allows for singleton runtime graph with all needed runtime modules for federation
211
- addEntryToSingleRuntimeChunk ( ) ;
212
- } else {
213
- callback ( ) ;
214
- }
215
- } ,
216
- ) ;
217
-
218
- // Function to add entry for undefined runtime
219
- const addEntryToSingleRuntimeChunk = ( ) => {
193
+ //@ts -ignore
194
+ exposes ,
195
+ shareScope ,
196
+ federationRuntimePluginInstance . entryFilePath ,
197
+ ) ;
198
+ const hasSingleRuntimeChunk =
199
+ compilation . options ?. optimization ?. runtimeChunk ;
200
+ dep . loc = { name } ;
220
201
compilation . addEntry (
221
202
compilation . options . context || '' ,
222
- //@ts -ignore
223
203
dep ,
224
204
{
225
- name : name ? name + '_partial' : undefined , // give unique name name
226
- runtime : undefined ,
205
+ name,
206
+ filename,
207
+ runtime : hasSingleRuntimeChunk ? false : runtime ,
227
208
library,
228
209
} ,
229
210
( error : WebpackError | null | undefined ) => {
230
211
if ( error ) return callback ( error ) ;
231
- callback ( ) ;
212
+ if ( hasSingleRuntimeChunk ) {
213
+ // Add to single runtime chunk as well.
214
+ // Allows for singleton runtime graph with all needed runtime modules for federation
215
+ addEntryToSingleRuntimeChunk ( ) ;
216
+ } else {
217
+ callback ( ) ;
218
+ }
232
219
} ,
233
220
) ;
234
- } ;
235
- } ) ;
221
+
222
+ // Function to add entry for undefined runtime
223
+ const addEntryToSingleRuntimeChunk = ( ) => {
224
+ compilation . addEntry (
225
+ compilation . options . context || '' ,
226
+ dep ,
227
+ {
228
+ name : name ? name + '_partial' : undefined , // give unique name name
229
+ runtime : undefined ,
230
+ library,
231
+ } ,
232
+ ( error : WebpackError | null | undefined ) => {
233
+ if ( error ) return callback ( error ) ;
234
+ callback ( ) ;
235
+ } ,
236
+ ) ;
237
+ } ;
238
+ } ,
239
+ ) ;
236
240
237
241
compiler . hooks . thisCompilation . tap (
238
242
PLUGIN_NAME ,
239
243
( compilation : Compilation , { normalModuleFactory } ) => {
240
244
compilation . dependencyFactories . set (
241
245
ContainerEntryDependency ,
242
- //@ts -ignore
243
246
new ContainerEntryModuleFactory ( ) ,
244
247
) ;
245
248
246
249
compilation . dependencyFactories . set (
247
- //@ts -ignore
248
250
ContainerExposedDependency ,
249
251
normalModuleFactory ,
250
252
) ;
0 commit comments