@@ -599,19 +599,21 @@ export class AngularCompilerPlugin implements Tapable {
599599 this . _donePromise = null ;
600600 } ) ;
601601
602- // TODO: consider if it's better to remove this plugin and instead make it wait on the
603- // VirtualFileSystemDecorator.
604602 compiler . plugin ( 'after-resolvers' , ( compiler : any ) => {
605- // Virtual file system.
606- // Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
607- // when the issuer is a `.ts` or `.ngfactory.js` file.
608- compiler . resolvers . normal . plugin ( 'before-resolve' , ( request : any , cb : ( ) => void ) => {
609- if ( this . done && ( request . request . endsWith ( '.ts' )
610- || ( request . context . issuer && / \. t s | n g f a c t o r y \. j s $ / . test ( request . context . issuer ) ) ) ) {
611- this . done . then ( ( ) => cb ( ) , ( ) => cb ( ) ) ;
612- } else {
613- cb ( ) ;
614- }
603+ compiler . plugin ( 'normal-module-factory' , ( nmf : any ) => {
604+ // Virtual file system.
605+ // TODO: consider if it's better to remove this plugin and instead make it wait on the
606+ // VirtualFileSystemDecorator.
607+ // Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
608+ // when the issuer is a `.ts` or `.ngfactory.js` file.
609+ nmf . plugin ( 'before-resolve' , ( request : any , callback : any ) => {
610+ if ( this . done && ( request . request . endsWith ( '.ts' )
611+ || ( request . context . issuer && / \. t s | n g f a c t o r y \. j s $ / . test ( request . context . issuer ) ) ) ) {
612+ this . done . then ( ( ) => callback ( null , request ) , ( ) => callback ( null , request ) ) ;
613+ } else {
614+ callback ( null , request ) ;
615+ }
616+ } ) ;
615617 } ) ;
616618 } ) ;
617619
0 commit comments