File tree 4 files changed +18
-9
lines changed
packages/karma-typescript/src/bundler
4 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 30
30
"karma-typescript" : " latest" ,
31
31
"karma-typescript-angular2-transform" : " latest" ,
32
32
"rxjs" : " ^6.5.4" ,
33
+ "csstype" : " ^3.0.7" ,
33
34
"typescript" : " latest"
34
35
}
35
36
}
Original file line number Diff line number Diff line change 1
1
import { Component } from "@angular/core" ;
2
+ // Testing a type only import
3
+ import { Properties } from 'csstype'
2
4
3
5
@Component ( {
4
6
selector : "app-hello" ,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class BundleItem {
15
15
}
16
16
17
17
public isScript ( ) : boolean {
18
- return ( this . filename && / \. ( j s | j s x | m j s | t s | t s x ) $ / . test ( this . filename ) )
18
+ return ( this . filename && ! this . isTypingsFile ( ) && / \. ( j s | j s x | m j s | t s | t s x ) $ / . test ( this . filename ) )
19
19
|| this . transformedScript ;
20
20
}
21
21
Original file line number Diff line number Diff line change @@ -195,14 +195,20 @@ export class Resolver {
195
195
return onFilenameResolved ( ) ;
196
196
}
197
197
198
- // This is probably a compiler path module (.d.ts)
199
- if ( bundleItem . isNpmModule ( ) && bundleItem . isTypingsFile ( ) &&
200
- bundleItem . filename . indexOf ( bundleItem . moduleName ) === - 1 ) {
201
- const filepath = PathTool . fixWindowsPath ( bundleItem . filename ) ;
202
- const matches = filepath . match ( / \/ n o d e _ m o d u l e s \/ ( .* ) \/ / ) ;
203
- if ( matches && matches [ 1 ] ) {
204
- moduleName = matches [ 1 ] ;
205
- this . log . debug ( "Resolved module name [%s] to [%s]" , bundleItem . moduleName , moduleName ) ;
198
+
199
+ if ( bundleItem . isNpmModule ( ) && bundleItem . isTypingsFile ( ) ) {
200
+ // This is probably a compiler path module (.d.ts)
201
+ if ( bundleItem . filename . indexOf ( bundleItem . moduleName ) === - 1 ) {
202
+ const filepath = PathTool . fixWindowsPath ( bundleItem . filename ) ;
203
+ const matches = filepath . match ( / \/ n o d e _ m o d u l e s \/ ( .* ) \/ / ) ;
204
+ if ( matches && matches [ 1 ] ) {
205
+ moduleName = matches [ 1 ] ;
206
+ this . log . debug ( "Resolved module name [%s] to [%s]" , bundleItem . moduleName , moduleName ) ;
207
+ }
208
+ }
209
+ // This is probably a type only module import
210
+ else {
211
+ return onFilenameResolved ( )
206
212
}
207
213
}
208
214
You can’t perform that action at this time.
0 commit comments