@@ -82,10 +82,15 @@ class SourceMapDevToolPlugin {
8282 compiler . hooks . compilation . tap ( "SourceMapDevToolPlugin" , ( compilation ) => {
8383 new SourceMapDevToolModuleOptionsPlugin ( options ) . apply ( compilation ) ;
8484
85- compilation . hooks . afterOptimizeChunkAssets . tap ( "SourceMapDevToolPlugin" , chunks => {
85+ compilation . hooks . afterOptimizeChunkAssets . tap ( {
86+ name : "SourceMapDevToolPlugin" ,
87+ context : true
88+ } , ( context , chunks ) => {
8689 const moduleToSourceNameMapping = new Map ( ) ;
8790 const tasks = [ ] ;
91+ const reportProgress = ( context && context . reportProgress ) ? context . reportProgress : ( ) => { } ;
8892
93+ reportProgress ( 0.0 , "SourceMapDevToolPlugin generation starting" ) ;
8994 chunks . forEach ( chunk => {
9095 chunk . files . forEach ( file => {
9196 if ( matchObject ( file ) ) {
@@ -155,7 +160,7 @@ class SourceMapDevToolPlugin {
155160 moduleToSourceNameMapping . set ( module , sourceName ) ;
156161 usedNamesSet . add ( sourceName ) ;
157162 }
158- tasks . forEach ( task => {
163+ tasks . forEach ( ( task , index ) => {
159164 const chunk = task . chunk ;
160165 const file = task . file ;
161166 const asset = task . asset ;
@@ -179,6 +184,8 @@ class SourceMapDevToolPlugin {
179184 }
180185 const sourceMapString = JSON . stringify ( sourceMap ) ;
181186 if ( sourceMapFilename ) {
187+ let progressFloat = ( 1.0 / tasks . length * index ) . toFixed ( 2 ) ;
188+ reportProgress ( progressFloat , `Generating sourcemap for: ${ sourceMapFilename } ` ) ;
182189 let filename = file ;
183190 let query = "" ;
184191 const idx = filename . indexOf ( "?" ) ;
@@ -208,6 +215,7 @@ class SourceMapDevToolPlugin {
208215 ) ;
209216 }
210217 } ) ;
218+ reportProgress ( 1.0 , "SourceMapDevToolPlugin has finished generating sourcemaps" ) ;
211219 } ) ;
212220 } ) ;
213221 }
0 commit comments