@@ -614,19 +614,21 @@ export class AngularCompilerPlugin implements Tapable {
614614 this . _donePromise = null ;
615615 } ) ;
616616
617- // TODO: consider if it's better to remove this plugin and instead make it wait on the
618- // VirtualFileSystemDecorator.
619617 compiler . plugin ( 'after-resolvers' , ( compiler : any ) => {
620- // Virtual file system.
621- // Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
622- // when the issuer is a `.ts` or `.ngfactory.js` file.
623- compiler . resolvers . normal . plugin ( 'before-resolve' , ( request : any , cb : ( ) => void ) => {
624- if ( this . done && ( request . request . endsWith ( '.ts' )
625- || ( request . context . issuer && / \. t s | n g f a c t o r y \. j s $ / . test ( request . context . issuer ) ) ) ) {
626- this . done . then ( ( ) => cb ( ) , ( ) => cb ( ) ) ;
627- } else {
628- cb ( ) ;
629- }
618+ compiler . plugin ( 'normal-module-factory' , ( nmf : any ) => {
619+ // Virtual file system.
620+ // TODO: consider if it's better to remove this plugin and instead make it wait on the
621+ // VirtualFileSystemDecorator.
622+ // Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
623+ // when the issuer is a `.ts` or `.ngfactory.js` file.
624+ nmf . plugin ( 'before-resolve' , ( request : any , callback : any ) => {
625+ if ( this . done && ( request . request . endsWith ( '.ts' )
626+ || ( request . context . issuer && / \. t s | n g f a c t o r y \. j s $ / . test ( request . context . issuer ) ) ) ) {
627+ this . done . then ( ( ) => callback ( null , request ) , ( ) => callback ( null , request ) ) ;
628+ } else {
629+ callback ( null , request ) ;
630+ }
631+ } ) ;
630632 } ) ;
631633 } ) ;
632634
0 commit comments