diff --git a/src/tscache.ts b/src/tscache.ts index 14756af..617f9ad 100644 --- a/src/tscache.ts +++ b/src/tscache.ts @@ -213,7 +213,8 @@ export class TsCache public getCompiled(id: string, snapshot: tsTypes.IScriptSnapshot, transform: () => ICode | undefined): ICode | undefined { this.context.info(`${blue("transpiling")} '${id}'`); - return this.getCached(this.codeCache, id, snapshot, false, transform); + // if !isolatedModules, compiled JS code can change if its imports do (e.g. enums). also, declarations can change based on imports as well + return this.getCached(this.codeCache, id, snapshot, Boolean(!this.options.isolatedModules || this.options.declaration), transform); } public getSyntacticDiagnostics(id: string, snapshot: tsTypes.IScriptSnapshot, check: () => tsTypes.Diagnostic[]): IDiagnostics[]