Installing the forked typescript
yarn add smotaal/TypeScript
Installing typescript-local
yarn add smotaal/typescript-local
Using the custom build
// replace this
import ts from 'typescript';
// with this
import ts from 'typescript-local';
You need to explicitly call
tsc-local
to run the custom compiler
build and import from 'typescript-local'
to use the custom build in Node.js.
Warning: Running `tsc` calls the original unmodified build to avoid unexpected outcomes.
Importing from MJS modules into TS files
// file: test.ts
import { runner } from './runner'; // -> runner.mjs
Importing from from MJS modules into MJS files
// file: test.mjs
import { runner } from './runner.mjs'; // -> runner.mjs
Transpiling TypeScript to Node.js ES modules (.mjs
)
yarn tsc-local --module "esnext" --target "esnext" --allowSyntheticDefaultImports --esModuleInterop --outDir "build" ./test.ts
Transpiling TypeScript & JavaScript to Node.js ES modules (.mjs
)
yarn tsc-local --module "esnext" --target "esnext" --allowJS --allowSyntheticDefaultImports --esModuleInterop --outDir "build" ./test.ts
Transpiling Node.js ES modules (.mjs
) to Standard ES2015 modules (.js
)
yarn tsc-local --module "es2015" --target "esnext" --allowJS --outDir "build" ./test.mjs
Transpiling Node.js ES modules (.mjs
) to Node.js CommonJS modules (.js
)
yarn tsc-local --allowJS --outDir "build" ./test.mjs
Visual Studio Code's workspace './.vscode/settings.json'