@@ -201,7 +201,7 @@ export default class BuildManifestPlugin {
201
201
this . rewrites . fallback = options . rewrites . fallback . map ( processRoute )
202
202
}
203
203
204
- createAssets ( compiler : any , compilation : any , assets : any ) {
204
+ createAssets ( compiler : any , compilation : any ) {
205
205
const compilationSpan = spans . get ( compilation ) || spans . get ( compiler )
206
206
const createAssetsSpan = (
207
207
compilationSpan || new Span ( { name : '' } )
@@ -299,7 +299,10 @@ export default class BuildManifestPlugin {
299
299
this . buildId
300
300
)
301
301
assetMap . lowPriorityFiles . push ( buildManifestPath , ssgManifestPath )
302
- assets [ ssgManifestPath ] = new sources . RawSource ( srcEmptySsgManifest )
302
+ compilation . emitAsset (
303
+ ssgManifestPath ,
304
+ new sources . RawSource ( srcEmptySsgManifest )
305
+ )
303
306
}
304
307
305
308
assetMap . pages = Object . keys ( assetMap . pages )
@@ -316,29 +319,30 @@ export default class BuildManifestPlugin {
316
319
buildManifestName = `fallback-${ BUILD_MANIFEST } `
317
320
}
318
321
319
- assets [ buildManifestName ] = new sources . RawSource (
320
- JSON . stringify ( assetMap , null , 2 )
322
+ compilation . emitAsset (
323
+ buildManifestName ,
324
+ new sources . RawSource ( JSON . stringify ( assetMap , null , 2 ) )
321
325
)
322
326
323
- assets [ `server/${ MIDDLEWARE_BUILD_MANIFEST } .js` ] = new sources . RawSource (
324
- `${ createEdgeRuntimeManifest ( assetMap ) } `
327
+ compilation . emitAsset (
328
+ `server/${ MIDDLEWARE_BUILD_MANIFEST } .js` ,
329
+ new sources . RawSource ( `${ createEdgeRuntimeManifest ( assetMap ) } ` )
325
330
)
326
331
327
332
if ( ! this . isDevFallback ) {
328
- const clientManifestPath = `${ CLIENT_STATIC_FILES_PATH } /${ this . buildId } /_buildManifest.js`
329
-
330
- assets [ clientManifestPath ] = new sources . RawSource (
331
- `self.__BUILD_MANIFEST = ${ generateClientManifest (
332
- assetMap ,
333
- this . rewrites ,
334
- this . clientRouterFilters ,
335
- compiler ,
336
- compilation
337
- ) } ;self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`
333
+ compilation . emitAsset (
334
+ `${ CLIENT_STATIC_FILES_PATH } /${ this . buildId } /_buildManifest.js` ,
335
+ new sources . RawSource (
336
+ `self.__BUILD_MANIFEST = ${ generateClientManifest (
337
+ assetMap ,
338
+ this . rewrites ,
339
+ this . clientRouterFilters ,
340
+ compiler ,
341
+ compilation
342
+ ) } ;self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`
343
+ )
338
344
)
339
345
}
340
-
341
- return assets
342
346
} )
343
347
}
344
348
@@ -349,8 +353,8 @@ export default class BuildManifestPlugin {
349
353
name : 'NextJsBuildManifest' ,
350
354
stage : webpack . Compilation . PROCESS_ASSETS_STAGE_ADDITIONS ,
351
355
} ,
352
- ( assets : any ) => {
353
- this . createAssets ( compiler , compilation , assets )
356
+ ( ) => {
357
+ this . createAssets ( compiler , compilation )
354
358
}
355
359
)
356
360
} )
0 commit comments