Skip to content

Commit c844f43

Browse files
committed
fix(compiler): make sure language service use updated compiler options
The compiler options are updated to have the proper module kind and are used by `_transpileOutput`. But when the compilation is delegated to the language service, the updated compiler options are not used, and the module kind ends up being the one in the initially read configuration. To make sure the language service gets the updated compiler options, this commit bumps the project version, thus ensuring that the internal `synchronizeHostData` of the language service refresh the options. (see https://github.com/microsoft/TypeScript/blob/459bd1994115fc4a14f7f1a80c36affe2281f2ea/src/services/services.ts#L1278-L1287)
1 parent c568f49 commit c844f43

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/compiler/ts-compiler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ export class TsCompiler implements TsCompilerInstance {
170170
}
171171
if (this._languageService) {
172172
this._logger.debug({ fileName }, 'getCompiledOutput(): compiling using language service')
173-
173+
// Make sure the language service gets the updated compiler options
174+
this._projectVersion++
174175
// Must set memory cache before attempting to compile
175176
this._updateMemoryCache(fileContent, fileName)
176177
const output: EmitOutput = this._languageService.getEmitOutput(fileName)

0 commit comments

Comments
 (0)