mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: allow configuration of the typescript-compiler (#66241)
This commit is contained in:
committed by
GitHub
parent
c94fe2d40e
commit
2972485a87
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user