Skip to content

Commit

Permalink
fix(perf): Only create extra programs when dealing with solution styl…
Browse files Browse the repository at this point in the history
…e tsconfigs
  • Loading branch information
Gerrit0 committed Dec 9, 2020
1 parent 2b0bd82 commit 6525a7b
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/lib/application.ts
Expand Up @@ -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`);
Expand Down

0 comments on commit 6525a7b

Please sign in to comment.