tsrun/ts/loader.ts

24 lines
735 B
TypeScript
Raw Normal View History

2022-03-12 13:43:54 +00:00
import * as plugins from './plugins.js';
import type { CompilerOptions } from 'typescript';
const defaultTsNodeOptions: plugins.tsNode.CreateOptions = {
compilerOptions: {
lib: ['dom'],
2022-03-24 17:47:16 +00:00
target: <any>'es2022', // Script Target should be a string -> 2 is for ES2015
2022-03-12 13:43:54 +00:00
experimentalDecorators: true,
2022-03-24 17:47:16 +00:00
useDefineForClassFields: false,
2022-03-12 13:43:54 +00:00
esModuleInterop: true,
strictNullChecks: false,
2022-05-25 08:55:35 +00:00
moduleResolution: <any>'nodenext',
2023-08-26 11:32:28 +00:00
module: <any>'nodenext',
2023-06-03 14:09:01 +00:00
verbatimModuleSyntax: true,
2022-03-12 13:43:54 +00:00
} as CompilerOptions,
esm: true,
skipIgnore: true,
2022-10-12 15:21:03 +00:00
transpileOnly: true,
2022-03-12 13:43:54 +00:00
};
2022-10-12 15:21:03 +00:00
export const { resolve, load, getFormat, transformSource } = plugins.tsNode.createEsmHooks(
plugins.tsNode.register(defaultTsNodeOptions)
) as any;