@@ -61,6 +61,7 @@ export class AotPlugin implements Tapable {
61
61
private _donePromise : Promise < void > | null ;
62
62
private _compiler : any = null ;
63
63
private _compilation : any = null ;
64
+ private _failedCompilation = false ;
64
65
65
66
private _typeCheck = true ;
66
67
private _skipCodeGeneration = false ;
@@ -87,6 +88,7 @@ export class AotPlugin implements Tapable {
87
88
get compilerHost ( ) { return this . _compilerHost ; }
88
89
get compilerOptions ( ) { return this . _compilerOptions ; }
89
90
get done ( ) { return this . _donePromise ; }
91
+ get failedCompilation ( ) { return this . _failedCompilation ; }
90
92
get entryModule ( ) {
91
93
const splitted = this . _entryModule . split ( '#' ) ;
92
94
const path = splitted [ 0 ] ;
@@ -374,11 +376,14 @@ export class AotPlugin implements Tapable {
374
376
375
377
compiler . plugin ( 'make' , ( compilation : any , cb : any ) => this . _make ( compilation , cb ) ) ;
376
378
compiler . plugin ( 'after-emit' , ( compilation : any , cb : any ) => {
377
- this . _donePromise = null ;
378
- this . _compilation = null ;
379
379
compilation . _ngToolsWebpackPluginInstance = null ;
380
380
cb ( ) ;
381
381
} ) ;
382
+ compiler . plugin ( 'done' , ( ) => {
383
+ this . _donePromise = null ;
384
+ this . _compilation = null ;
385
+ this . _failedCompilation = false ;
386
+ } ) ;
382
387
383
388
compiler . plugin ( 'after-resolvers' , ( compiler : any ) => {
384
389
// Virtual file system.
@@ -578,10 +583,13 @@ export class AotPlugin implements Tapable {
578
583
. then ( ( ) => {
579
584
if ( this . _compilation . errors == 0 ) {
580
585
this . _compilerHost . resetChangedFileTracker ( ) ;
586
+ } else {
587
+ this . _failedCompilation = true ;
581
588
}
582
589
583
590
cb ( ) ;
584
591
} , ( err : any ) => {
592
+ this . _failedCompilation = true ;
585
593
compilation . errors . push ( err . stack ) ;
586
594
cb ( ) ;
587
595
} ) ;
0 commit comments