Get a list of import paths and paths from a TypeScript, JSX, TSX, or JavaScript file.
const {imports, exports} = transpiler.scan(`
import {foo} from "baz";
const hello = "hi!";
`);
console.log(imports); // ["baz"]
console.log(exports); // ["hello"]
The code to scan
Get a list of import paths from a TypeScript, JSX, TSX, or JavaScript file.
const imports = transpiler.scanImports(`
import {foo} from "baz";
import type {FooType} from "bar";
import type {DogeType} from "wolf";
`);
console.log(imports); // ["baz"]
This is a fast path which performs less work than scan
.
The code to scan
Transpile code from TypeScript or JSX into valid JavaScript. This function does not resolve imports.
The code to transpile
Optional
loader: JavaScriptLoaderTranspile code from TypeScript or JSX into valid JavaScript. This function does not resolve imports.
The code to transpile
Transpile code from TypeScript or JSX into valid JavaScript. This function does not resolve imports.
The code to transpile
An object to pass to macros
Transpile code from TypeScript or JSX into valid JavaScript. This function does not resolve imports.
The code to transpile
Generated using TypeDoc
Quickly transpile TypeScript, JSX, or JS to modern JavaScript.
Example