Skip to content

Commit

Permalink
emit must be called on build program to leverage caching
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed May 11, 2021
1 parent 2f142b6 commit c3cec49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next/lib/typescript/runTypeCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export async function runTypeCheck(
}

let program: import('typescript').Program
let result: import('typescript').EmitResult
let incremental = false
if (options.incremental && cacheDir) {
incremental = true
Expand All @@ -55,11 +56,12 @@ export async function runTypeCheck(
tsBuildInfoFile: path.join(cacheDir, '.tsbuildinfo'),
},
})
result = builderProgram.emit()
program = builderProgram.getProgram()
} else {
program = ts.createProgram(effectiveConfiguration.fileNames, options)
result = program.emit()
}
const result = program.emit()

// Intended to match:
// - pages/test.js
Expand Down

0 comments on commit c3cec49

Please sign in to comment.