@@ -325,7 +325,7 @@ export class AngularCompilerPlugin {
325325
326326 private _getChangedTsFiles ( ) {
327327 return this . _compilerHost . getChangedFilePaths ( )
328- . filter ( k => k . endsWith ( '.ts' ) && ! k . endsWith ( '.d.ts' ) )
328+ . filter ( k => ( k . endsWith ( '.ts' ) || k . endsWith ( '.tsx' ) ) && ! k . endsWith ( '.d.ts' ) )
329329 . filter ( k => this . _compilerHost . fileExists ( k ) ) ;
330330 }
331331
@@ -499,7 +499,7 @@ export class AngularCompilerPlugin {
499499 modulePath = lazyRouteTSFile ;
500500 moduleKey = `${ lazyRouteModule } ${ moduleName ? '#' + moduleName : '' } ` ;
501501 } else {
502- modulePath = lazyRouteTSFile . replace ( / ( \. d ) ? \. t s $ / , '' ) ;
502+ modulePath = lazyRouteTSFile . replace ( / ( \. d ) ? \. t s x ? $ / , '' ) ;
503503 modulePath += '.ngfactory.js' ;
504504 const factoryModuleName = moduleName ? `#${ moduleName } NgFactory` : '' ;
505505 moduleKey = `${ lazyRouteModule } .ngfactory${ factoryModuleName } ` ;
@@ -686,7 +686,8 @@ export class AngularCompilerPlugin {
686686 // Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
687687 // when the issuer is a `.ts` or `.ngfactory.js` file.
688688 nmf . hooks . beforeResolve . tapAsync ( 'angular-compiler' , ( request : any , callback : any ) => {
689- if ( this . done && ( request && request . request . endsWith ( '.ts' )
689+ if ( this . done
690+ && ( request && ( request . request . endsWith ( '.ts' ) || request . request . endsWith ( '.tsx' ) )
690691 || ( request && request . context . issuer
691692 && / \. t s | n g f a c t o r y \. j s $ / . test ( request . context . issuer ) ) ) ) {
692693 this . done . then ( ( ) => callback ( null , request ) , ( ) => callback ( null , request ) ) ;
@@ -893,7 +894,7 @@ export class AngularCompilerPlugin {
893894 }
894895
895896 getCompiledFile ( fileName : string ) {
896- const outputFile = fileName . replace ( / .t s $ / , '.js' ) ;
897+ const outputFile = fileName . replace ( / .t s x ? $ / , '.js' ) ;
897898 let outputText : string ;
898899 let sourceMap : string | undefined ;
899900 let errorDependencies : string [ ] = [ ] ;
@@ -917,7 +918,8 @@ export class AngularCompilerPlugin {
917918 }
918919 } else {
919920 // Check if the TS input file and the JS output file exist.
920- if ( ( fileName . endsWith ( '.ts' ) && ! this . _compilerHost . fileExists ( fileName , false ) )
921+ if ( ( ( fileName . endsWith ( '.ts' ) || fileName . endsWith ( '.tsx' ) )
922+ && ! this . _compilerHost . fileExists ( fileName , false ) )
921923 || ! this . _compilerHost . fileExists ( outputFile , false ) ) {
922924 let msg = `${ fileName } is missing from the TypeScript compilation. `
923925 + `Please make sure it is in your tsconfig via the 'files' or 'include' property.` ;
0 commit comments