@@ -325,7 +325,7 @@ export class AngularCompilerPlugin {
325
325
326
326
private _getChangedTsFiles ( ) {
327
327
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' ) )
329
329
. filter ( k => this . _compilerHost . fileExists ( k ) ) ;
330
330
}
331
331
@@ -499,7 +499,7 @@ export class AngularCompilerPlugin {
499
499
modulePath = lazyRouteTSFile ;
500
500
moduleKey = `${ lazyRouteModule } ${ moduleName ? '#' + moduleName : '' } ` ;
501
501
} else {
502
- modulePath = lazyRouteTSFile . replace ( / ( \. d ) ? \. t s $ / , '' ) ;
502
+ modulePath = lazyRouteTSFile . replace ( / ( \. d ) ? \. t s x ? $ / , '' ) ;
503
503
modulePath += '.ngfactory.js' ;
504
504
const factoryModuleName = moduleName ? `#${ moduleName } NgFactory` : '' ;
505
505
moduleKey = `${ lazyRouteModule } .ngfactory${ factoryModuleName } ` ;
@@ -686,7 +686,8 @@ export class AngularCompilerPlugin {
686
686
// Wait for the plugin to be done when requesting `.ts` files directly (entry points), or
687
687
// when the issuer is a `.ts` or `.ngfactory.js` file.
688
688
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' ) )
690
691
|| ( request && request . context . issuer
691
692
&& / \. t s | n g f a c t o r y \. j s $ / . test ( request . context . issuer ) ) ) ) {
692
693
this . done . then ( ( ) => callback ( null , request ) , ( ) => callback ( null , request ) ) ;
@@ -893,7 +894,7 @@ export class AngularCompilerPlugin {
893
894
}
894
895
895
896
getCompiledFile ( fileName : string ) {
896
- const outputFile = fileName . replace ( / .t s $ / , '.js' ) ;
897
+ const outputFile = fileName . replace ( / .t s x ? $ / , '.js' ) ;
897
898
let outputText : string ;
898
899
let sourceMap : string | undefined ;
899
900
let errorDependencies : string [ ] = [ ] ;
@@ -917,7 +918,8 @@ export class AngularCompilerPlugin {
917
918
}
918
919
} else {
919
920
// 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 ) )
921
923
|| ! this . _compilerHost . fileExists ( outputFile , false ) ) {
922
924
let msg = `${ fileName } is missing from the TypeScript compilation. `
923
925
+ `Please make sure it is in your tsconfig via the 'files' or 'include' property.` ;
0 commit comments