Get a list of import paths from a TypeScript, JSX, TSX, or JavaScript file.
Symbol
Transpiler.scanImports
@param code
The code to scan
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
.
Referenced types
type StringOrBuffer = string | NodeJS.TypedArray | ArrayBufferLike