@@ -33,51 +33,28 @@ export class WatchStateLoggerPlugin {
33
33
. keys ( compilation . assets )
34
34
. filter ( assetKey => compilation . assets [ assetKey ] . emitted ) ;
35
35
36
- const webpackRuntimeFiles = getWebpackRuntimeOnlyFiles ( compilation ) ;
37
- const entryPointFiles = getEntryPointFiles ( compilation ) ;
36
+ const chunkFiles = getChunkFiles ( compilation ) ;
38
37
39
38
process . send && process . send ( messages . compilationComplete , error => null ) ;
40
39
// Send emitted files so they can be LiveSynced if need be
41
- process . send && process . send ( { emittedFiles, webpackRuntimeFiles , entryPointFiles } , error => null ) ;
40
+ process . send && process . send ( { emittedFiles, chunkFiles } , error => null ) ;
42
41
} ) ;
43
42
}
44
43
}
45
44
46
- function getWebpackRuntimeOnlyFiles ( compilation ) {
47
- let runtimeOnlyFiles = [ ] ;
45
+ function getChunkFiles ( compilation ) {
46
+ const chunkFiles = [ ] ;
48
47
try {
49
- runtimeOnlyFiles = [ ] . concat ( ...Array . from < any > ( compilation . entrypoints . values ( ) )
50
- . map ( entrypoint => entrypoint . runtimeChunk )
51
- // filter embedded runtime chunks (e.g. part of bundle.js or inspector-modules.js)
52
- . filter ( runtimeChunk => ! ! runtimeChunk && runtimeChunk . preventIntegration )
53
- . map ( runtimeChunk => runtimeChunk . files ) )
54
- // get only the unique files in case of "single" runtime (e.g. runtime.js)
55
- . filter ( ( value , index , self ) => self . indexOf ( value ) === index ) ;
56
- } catch ( e ) {
57
- // breaking change in the Webpack API
58
- console . log ( "Warning: Unable to find Webpack runtime files." ) ;
59
- }
60
-
61
- return runtimeOnlyFiles ;
62
- }
63
-
64
- function getEntryPointFiles ( compilation ) {
65
- const entryPointFiles = [ ] ;
66
- try {
67
- Array . from ( compilation . entrypoints . values ( ) )
68
- . forEach ( ( entrypoint : any ) => {
69
- for ( const entryChunk of entrypoint . chunks ) {
70
- entryChunk . files . forEach ( fileName => {
71
- if ( fileName . indexOf ( "hot-update" ) === - 1 ) {
72
- entryPointFiles . push ( fileName ) ;
73
- }
74
- } ) ;
48
+ compilation . chunks . forEach ( chunk => {
49
+ chunk . files . forEach ( file => {
50
+ if ( file . indexOf ( "hot-update" ) === - 1 ) {
51
+ chunkFiles . push ( file ) ;
75
52
}
76
53
} ) ;
54
+ } ) ;
77
55
} catch ( e ) {
78
- console . log ( "Warning: Unable to find Webpack entry point files." ) ;
56
+ console . log ( "Warning: Unable to find chunk files." ) ;
79
57
}
80
58
81
- return entryPointFiles
82
- . filter ( ( value , index , self ) => self . indexOf ( value ) === index ) ; // get only the unique files
83
- }
59
+ return chunkFiles ;
60
+ }
0 commit comments