feat: allow configuration of the typescript-compiler (#66241)

This commit is contained in:
Oliver Eyton-Williams
2026-03-05 05:18:18 +01:00
committed by GitHub
parent c94fe2d40e
commit 2972485a87
5 changed files with 27 additions and 18 deletions
@@ -16,10 +16,15 @@ export class Compiler {
this.tsvfs = tsvfs;
}
async setup(opts?: { useNodeModules: boolean }) {
async setup(opts?: { useNodeModules?: boolean; compilerOptions?: unknown }) {
const ts = this.ts;
const tsvfs = this.tsvfs;
const parsedOptions = ts.convertCompilerOptionsFromJson(
opts?.compilerOptions ?? {},
'/'
);
const compilerOptions: CompilerOptions = {
target: ts.ScriptTarget.ES2024,
module: ts.ModuleKind.Preserve, // Babel is handling module transformation, so TS should leave them alone.
@@ -28,7 +33,8 @@ export class Compiler {
// sync with TypeScript over time. It was last synced with TypeScript
// 3.8.0-rc."
jsx: ts.JsxEmit.Preserve, // Babel will handle JSX,
allowUmdGlobalAccess: true // Necessary because React is loaded via a UMD script.
allowUmdGlobalAccess: true, // Necessary because React is loaded via a UMD script.
...parsedOptions.options
};
const fsMap = opts?.useNodeModules