@@ -50,16 +50,21 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) {
50
50
...rest
51
51
) ;
52
52
}
53
- if ( ! tsNodeService . enabled ( ) )
54
- return defer ( ) ;
53
+ if ( ! tsNodeService . enabled ( ) ) return defer ( ) ;
55
54
56
55
// Map from emit to source extensions
57
- if ( ! isMain && canReplaceJsWithTsExt ( tsNodeService , request , parent ?. filename ) ) {
56
+ if (
57
+ ! isMain &&
58
+ canReplaceJsWithTsExt ( tsNodeService , request , parent ?. filename )
59
+ ) {
58
60
try {
59
61
return originalResolveFilename . call (
60
62
this ,
61
63
request . slice ( 0 , - 3 ) ,
62
- parent , isMain , options , ...rest
64
+ parent ,
65
+ isMain ,
66
+ options ,
67
+ ...rest
63
68
) ;
64
69
} catch ( e ) {
65
70
const mainFile = defer ( ) ;
@@ -68,7 +73,10 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) {
68
73
return originalResolveFilename . call (
69
74
this ,
70
75
mainFile . slice ( 0 , - 3 ) ,
71
- parent , isMain , options , ...rest
76
+ parent ,
77
+ isMain ,
78
+ options ,
79
+ ...rest
72
80
) ;
73
81
}
74
82
return mainFile ;
@@ -80,7 +88,11 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) {
80
88
}
81
89
}
82
90
83
- function canReplaceJsWithTsExt ( service : Service , request : string , parentPath ?: string ) {
91
+ function canReplaceJsWithTsExt (
92
+ service : Service ,
93
+ request : string ,
94
+ parentPath ?: string
95
+ ) {
84
96
if ( ! parentPath || service . ignored ( parentPath ) ) return false ;
85
97
if ( isRelativeSpecifier ( request ) && request . slice ( - 3 ) === '.js' ) {
86
98
if ( ! parentPath ) return true ;
0 commit comments