Commit 9e12a33 authored Mar 4, 2021 Verified
1 parent d68a8eb commit 9e12a33 Copy full SHA for 9e12a33
File tree 1 file changed +24
-30
lines changed
1 file changed +24
-30
lines changed Original file line number Diff line number Diff line change @@ -402,11 +402,7 @@ class CopyPlugin {
402
402
}
403
403
404
404
if ( ! result . source ) {
405
- let startTime ;
406
-
407
- if ( cache ) {
408
- startTime = Date . now ( ) ;
409
- }
405
+ const startTime = Date . now ( ) ;
410
406
411
407
logger . debug ( `reading '${ absoluteFilename } '...` ) ;
412
408
@@ -424,40 +420,38 @@ class CopyPlugin {
424
420
425
421
result . source = new RawSource ( data ) ;
426
422
427
- if ( cache ) {
428
- let snapshot ;
423
+ let snapshot ;
424
+
425
+ logger . debug ( `creating snapshot for '${ absoluteFilename } '...` ) ;
426
+
427
+ try {
428
+ snapshot = await CopyPlugin . createSnapshot (
429
+ compilation ,
430
+ startTime ,
431
+ absoluteFilename
432
+ ) ;
433
+ } catch ( error ) {
434
+ compilation . errors . push ( error ) ;
435
+
436
+ return ;
437
+ }
429
438
430
- logger . debug ( `creating snapshot for '${ absoluteFilename } '...` ) ;
439
+ if ( snapshot ) {
440
+ logger . debug ( `created snapshot for '${ absoluteFilename } '` ) ;
441
+ logger . debug ( `storing cache for '${ absoluteFilename } '...` ) ;
431
442
432
443
try {
433
- snapshot = await CopyPlugin . createSnapshot (
434
- compilation ,
435
- startTime ,
436
- absoluteFilename
437
- ) ;
444
+ await cache . storePromise ( `${ sourceFilename } |${ index } ` , null , {
445
+ source : result . source ,
446
+ snapshot,
447
+ } ) ;
438
448
} catch ( error ) {
439
449
compilation . errors . push ( error ) ;
440
450
441
451
return ;
442
452
}
443
453
444
- if ( snapshot ) {
445
- logger . debug ( `created snapshot for '${ absoluteFilename } '` ) ;
446
- logger . debug ( `storing cache for '${ absoluteFilename } '...` ) ;
447
-
448
- try {
449
- await cache . storePromise ( `${ sourceFilename } |${ index } ` , null , {
450
- source : result . source ,
451
- snapshot,
452
- } ) ;
453
- } catch ( error ) {
454
- compilation . errors . push ( error ) ;
455
-
456
- return ;
457
- }
458
-
459
- logger . debug ( `stored cache for '${ absoluteFilename } '` ) ;
460
- }
454
+ logger . debug ( `stored cache for '${ absoluteFilename } '` ) ;
461
455
}
462
456
}
463
457
You can’t perform that action at this time.
0 commit comments