@@ -61,6 +61,7 @@ export class AotPlugin implements Tapable {
6161 private _donePromise : Promise < void > | null ;
6262 private _compiler : any = null ;
6363 private _compilation : any = null ;
64+ private _failedCompilation = false ;
6465
6566 private _typeCheck = true ;
6667 private _skipCodeGeneration = false ;
@@ -87,6 +88,7 @@ export class AotPlugin implements Tapable {
8788 get compilerHost ( ) { return this . _compilerHost ; }
8889 get compilerOptions ( ) { return this . _compilerOptions ; }
8990 get done ( ) { return this . _donePromise ; }
91+ get failedCompilation ( ) { return this . _failedCompilation ; }
9092 get entryModule ( ) {
9193 const splitted = this . _entryModule . split ( '#' ) ;
9294 const path = splitted [ 0 ] ;
@@ -374,11 +376,14 @@ export class AotPlugin implements Tapable {
374376
375377 compiler . plugin ( 'make' , ( compilation : any , cb : any ) => this . _make ( compilation , cb ) ) ;
376378 compiler . plugin ( 'after-emit' , ( compilation : any , cb : any ) => {
377- this . _donePromise = null ;
378- this . _compilation = null ;
379379 compilation . _ngToolsWebpackPluginInstance = null ;
380380 cb ( ) ;
381381 } ) ;
382+ compiler . plugin ( 'done' , ( ) => {
383+ this . _donePromise = null ;
384+ this . _compilation = null ;
385+ this . _failedCompilation = false ;
386+ } ) ;
382387
383388 compiler . plugin ( 'after-resolvers' , ( compiler : any ) => {
384389 // Virtual file system.
@@ -578,10 +583,13 @@ export class AotPlugin implements Tapable {
578583 . then ( ( ) => {
579584 if ( this . _compilation . errors == 0 ) {
580585 this . _compilerHost . resetChangedFileTracker ( ) ;
586+ } else {
587+ this . _failedCompilation = true ;
581588 }
582589
583590 cb ( ) ;
584591 } , ( err : any ) => {
592+ this . _failedCompilation = true ;
585593 compilation . errors . push ( err . stack ) ;
586594 cb ( ) ;
587595 } ) ;
0 commit comments