diff --git a/src/lib/application.ts b/src/lib/application.ts index 0771db607..437aa052c 100644 --- a/src/lib/application.ts +++ b/src/lib/application.ts @@ -212,17 +212,22 @@ export class Application extends ChildableComponent< // This might be a solution style tsconfig, in which case we need to add a program for each // reference so that the converter can look through each of these. - const resolvedReferences = programs[0].getResolvedProjectReferences(); - for (const ref of resolvedReferences ?? []) { - if (!ref) continue; // This indicates bad configuration... will be reported later. - - programs.push( - ts.createProgram({ - options: ref.commandLine.options, - rootNames: ref.commandLine.fileNames, - projectReferences: ref.commandLine.projectReferences, - }) + if (programs[0].getRootFileNames().length === 0) { + this.logger.verbose( + "tsconfig appears to be a solution style tsconfig - creating programs for references" ); + const resolvedReferences = programs[0].getResolvedProjectReferences(); + for (const ref of resolvedReferences ?? []) { + if (!ref) continue; // This indicates bad configuration... will be reported later. + + programs.push( + ts.createProgram({ + options: ref.commandLine.options, + rootNames: ref.commandLine.fileNames, + projectReferences: ref.commandLine.projectReferences, + }) + ); + } } this.logger.verbose(`Converting with ${programs.length} programs`);