Skip to content

Commit

Permalink
fix(typescript): set module resolution cache (volarjs#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored Oct 25, 2024
1 parent f4cec29 commit 0555ec4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/typescript/lib/protocol/createProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ export interface TypeScriptProjectHost extends Pick<
| 'getProjectVersion'
> { }

declare module 'typescript' {
interface LanguageServiceHost {
/**
* @internal
*/
getModuleResolutionCache?(): ts.ModuleResolutionCache;
}
}

export function createLanguageServiceHost<T>(
ts: typeof import('typescript'),
sys: ReturnType<typeof createSys> | ts.System,
Expand Down Expand Up @@ -188,6 +197,8 @@ export function createLanguageServiceHost<T>(
return resolveModuleName(moduleName, containingFile, options, moduleCache, redirectedReference).resolvedModule;
});
};

languageServiceHost.getModuleResolutionCache = () => moduleCache;
}

return {
Expand Down

0 comments on commit 0555ec4

Please sign in to comment.