|
@@ -1070,6 +1070,7 @@ function loadTSConfig(
|
|
|
configPath: string,
|
|
configPath: string,
|
|
|
ts: typeof TS,
|
|
ts: typeof TS,
|
|
|
fs: FS,
|
|
fs: FS,
|
|
|
|
|
+ visited = new Set<string>(),
|
|
|
): TS.ParsedCommandLine[] {
|
|
): TS.ParsedCommandLine[] {
|
|
|
// The only case where `fs` is NOT `ts.sys` is during tests.
|
|
// The only case where `fs` is NOT `ts.sys` is during tests.
|
|
|
// parse config host requires an extra `readDirectory` method
|
|
// parse config host requires an extra `readDirectory` method
|
|
@@ -1089,14 +1090,15 @@ function loadTSConfig(
|
|
|
configPath,
|
|
configPath,
|
|
|
)
|
|
)
|
|
|
const res = [config]
|
|
const res = [config]
|
|
|
|
|
+ visited.add(configPath)
|
|
|
if (config.projectReferences) {
|
|
if (config.projectReferences) {
|
|
|
for (const ref of config.projectReferences) {
|
|
for (const ref of config.projectReferences) {
|
|
|
const refPath = ts.resolveProjectReferencePath(ref)
|
|
const refPath = ts.resolveProjectReferencePath(ref)
|
|
|
- if (!fs.fileExists(refPath)) {
|
|
|
|
|
|
|
+ if (visited.has(refPath) || !fs.fileExists(refPath)) {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
tsConfigRefMap.set(refPath, configPath)
|
|
tsConfigRefMap.set(refPath, configPath)
|
|
|
- res.unshift(...loadTSConfig(refPath, ts, fs))
|
|
|
|
|
|
|
+ res.unshift(...loadTSConfig(refPath, ts, fs, visited))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return res
|
|
return res
|