@@ -101,7 +101,8 @@ function resolveConfigFile(baseConfigFile: string, referencedConfigFile: string)
101
101
referencedConfigFile += '.json' ;
102
102
const currentDir = path . dirname ( baseConfigFile ) ;
103
103
let resolvedConfigFile = path . resolve ( currentDir , referencedConfigFile ) ;
104
- if ( referencedConfigFile . indexOf ( '/' ) !== - 1 && referencedConfigFile . indexOf ( '.' ) !== - 1 && ! fs . existsSync ( referencedConfigFile ) )
104
+ // TODO: I don't see how this makes sense, delete in the next minor release.
105
+ if ( referencedConfigFile . includes ( '/' ) && referencedConfigFile . includes ( '.' ) && ! fs . existsSync ( resolvedConfigFile ) )
105
106
resolvedConfigFile = path . join ( currentDir , 'node_modules' , referencedConfigFile ) ;
106
107
return resolvedConfigFile ;
107
108
}
@@ -117,6 +118,7 @@ function loadTsConfig(
117
118
let result : LoadedTsConfig = {
118
119
tsConfigPath : configFilePath ,
119
120
} ;
121
+ // Retain result instance below, so that caching works.
120
122
visited . set ( configFilePath , result ) ;
121
123
122
124
if ( ! fs . existsSync ( configFilePath ) )
@@ -137,7 +139,8 @@ function loadTsConfig(
137
139
const extendsDir = path . dirname ( extendedConfig ) ;
138
140
base . baseUrl = path . join ( extendsDir , base . baseUrl ) ;
139
141
}
140
- result = { ...result , ...base , tsConfigPath : configFilePath } ;
142
+ // Retain result instance, so that caching works.
143
+ Object . assign ( result , base , { tsConfigPath : configFilePath } ) ;
141
144
}
142
145
143
146
const loadedConfig = Object . fromEntries ( Object . entries ( {
@@ -146,7 +149,8 @@ function loadTsConfig(
146
149
allowJs : parsedConfig ?. compilerOptions ?. allowJs ,
147
150
} ) . filter ( ( [ , value ] ) => value !== undefined ) ) ;
148
151
149
- result = { ...result , ...loadedConfig } ;
152
+ // Retain result instance, so that caching works.
153
+ Object . assign ( result , loadedConfig ) ;
150
154
151
155
for ( const ref of parsedConfig . references || [ ] )
152
156
references . push ( loadTsConfig ( resolveConfigFile ( configFilePath , ref . path ) , references , visited ) ) ;
0 commit comments