Skip to content

Commit c40bc34

Browse files
authored
fix(legacy): add useCaseSensitiveFileNames wherever needed (#3683)
fixes #3665
1 parent 9fc62e5 commit c40bc34

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/legacy/compiler/ts-compiler.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ export class TsCompiler implements TsCompilerInstance {
108108
getCurrentDirectory: () => this.configSet.cwd,
109109
realpath: this._ts.sys.realpath && memoize(this._ts.sys.realpath),
110110
getDirectories: memoize(this._ts.sys.getDirectories),
111+
useCaseSensitiveFileNames: () => this._ts.sys.useCaseSensitiveFileNames,
111112
}
112113
this._moduleResolutionCache = this._ts.createModuleResolutionCache(
113114
this.configSet.cwd,
114-
(x) => x,
115+
this._ts.sys.useCaseSensitiveFileNames ? (x) => x : (x) => x.toLowerCase(),
115116
this._compilerOptions,
116117
)
117118
this._createLanguageService()
@@ -285,6 +286,7 @@ export class TsCompiler implements TsCompilerInstance {
285286
.forEach((fileName) => this._fileVersionCache!.set(fileName, 0))
286287
/* istanbul ignore next */
287288
const serviceHost: LanguageServiceHost = {
289+
useCaseSensitiveFileNames: () => this._ts.sys.useCaseSensitiveFileNames,
288290
getProjectVersion: () => String(this._projectVersion),
289291
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
290292
getScriptFileNames: () => [...this._fileVersionCache!.keys()],
@@ -346,7 +348,10 @@ export class TsCompiler implements TsCompilerInstance {
346348

347349
this._logger.debug('created language service')
348350

349-
this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry())
351+
this._languageService = this._ts.createLanguageService(
352+
serviceHost,
353+
this._ts.createDocumentRegistry(this._ts.sys.useCaseSensitiveFileNames, this.configSet.cwd),
354+
)
350355
this.program = this._languageService.getProgram()
351356
}
352357

0 commit comments

Comments
 (0)