diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 8a94393e2ce..6206c22eeba 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -275,7 +275,7 @@ namespace ts { } } - export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: ProgramHost) { + export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: { createHash?(data: string): string; }) { const originalGetSourceFile = compilerHost.getSourceFile; const computeHash = host.createHash || generateDjb2Hash; compilerHost.getSourceFile = (...args) => { diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 499848fdf92..31b5d7d75d8 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -263,6 +263,7 @@ namespace ts { const host = createCompilerHost(options); const currentDirectory = host.getCurrentDirectory(); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + setGetSourceFileAsHashVersioned(host, sys); changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); enableStatistics(options); const oldProgram = readBuilderProgram(options, path => host.readFile(path));