@@ -116,7 +116,7 @@ export function getNonAotConfig(wco: WebpackConfigOptions) {
116
116
const tsConfigPath = path . resolve ( projectRoot , appConfig . root , appConfig . tsconfig ) ;
117
117
118
118
return {
119
- module : { rules : [ { test : / \. t s $ / , loader : webpackLoader } ] } ,
119
+ module : { rules : [ { test : / \. t s x ? $ / , loader : webpackLoader } ] } ,
120
120
plugins : [ _createAotPlugin ( wco , { tsConfigPath, skipCodeGeneration : true } ) ]
121
121
} ;
122
122
}
@@ -130,7 +130,7 @@ export function getAotConfig(wco: WebpackConfigOptions) {
130
130
131
131
// Fallback to exclude spec files from AoT compilation on projects using a shared tsconfig.
132
132
if ( testTsConfigPath === tsConfigPath ) {
133
- let exclude = [ '**/*.spec.ts' ] ;
133
+ let exclude = [ '**/*.spec.ts' , '**/*.spec.tsx ' ] ;
134
134
if ( appConfig . test ) {
135
135
exclude . push ( path . join ( projectRoot , appConfig . root , appConfig . test ) ) ;
136
136
}
@@ -146,8 +146,8 @@ export function getAotConfig(wco: WebpackConfigOptions) {
146
146
}
147
147
148
148
const test = AngularCompilerPlugin . isSupported ( )
149
- ? / (?: \. n g f a c t o r y \. j s | \. n g s t y l e \. j s | \. t s ) $ /
150
- : / \. t s $ / ;
149
+ ? / (?: \. n g f a c t o r y \. j s | \. n g s t y l e \. j s | \. t s x ? ) $ /
150
+ : / \. t s x ? $ / ;
151
151
152
152
return {
153
153
module : { rules : [ { test, use : [ ...boLoader , webpackLoader ] } ] } ,
@@ -174,7 +174,7 @@ export function getNonAotTestConfig(wco: WebpackConfigOptions) {
174
174
// Force include main and polyfills.
175
175
// This is needed for AngularCompilerPlugin compatibility with existing projects,
176
176
// since TS compilation there is stricter and tsconfig.spec.ts doesn't include them.
177
- const include = [ appConfig . main , appConfig . polyfills , '**/*.spec.ts' ] ;
177
+ const include = [ appConfig . main , appConfig . polyfills , '**/*.spec.ts' , '**/*.spec.tsx' ] ;
178
178
if ( appConfig . test ) {
179
179
include . push ( appConfig . test ) ;
180
180
}
@@ -188,7 +188,7 @@ export function getNonAotTestConfig(wco: WebpackConfigOptions) {
188
188
}
189
189
190
190
return {
191
- module : { rules : [ { test : / \. t s $ / , loader : webpackLoader } ] } ,
191
+ module : { rules : [ { test : / \. t s x ? $ / , loader : webpackLoader } ] } ,
192
192
plugins : [ _createAotPlugin ( wco , pluginOptions , false ) ]
193
193
} ;
194
194
}
0 commit comments