@@ -31,6 +31,7 @@ export class WatchStateLoggerPlugin {
3131 console . log ( messages . compilationComplete ) ;
3232 }
3333
34+ const runtimeOnlyFiles = getWebpackRuntimeOnlyFiles ( compilation , compiler . context ) ;
3435 let emittedFiles = Object
3536 . keys ( compilation . assets )
3637 . filter ( assetKey => compilation . assets [ assetKey ] . emitted ) ;
@@ -42,7 +43,27 @@ export class WatchStateLoggerPlugin {
4243
4344 process . send && process . send ( messages . compilationComplete , error => null ) ;
4445 // Send emitted files so they can be LiveSynced if need be
45- process . send && process . send ( { emittedFiles : emittedFilesFakePaths } , error => null ) ;
46+ process . send && process . send ( { emittedFiles : emittedFilesFakePaths , webpackRuntimeFiles : runtimeOnlyFiles } , error => null ) ;
4647 } ) ;
4748 }
4849}
50+
51+ function getWebpackRuntimeOnlyFiles ( compilation , basePath ) {
52+ let runtimeOnlyFiles = [ ] ;
53+ try {
54+ runtimeOnlyFiles = [ ] . concat ( ...Array . from < any > ( compilation . entrypoints . values ( ) )
55+ . map ( entrypoint => entrypoint . runtimeChunk )
56+ // filter embedded runtime chunks (e.g. part of bundle.js or inspector-modules.js)
57+ . filter ( runtimeChunk => ! ! runtimeChunk && runtimeChunk . preventIntegration )
58+ . map ( runtimeChunk => runtimeChunk . files ) )
59+ // get only the unique files in case of "single" runtime (e.g. runtime.js)
60+ . filter ( ( value , index , self ) => self . indexOf ( value ) === index )
61+ // convert to absolute paths
62+ . map ( fileName => join ( basePath , fileName ) ) ;
63+ } catch ( e ) {
64+ // breaking change in the Webpack API
65+ console . log ( "Warning: Unable to find Webpack runtime files." ) ;
66+ }
67+
68+ return runtimeOnlyFiles ;
69+ }
0 commit comments