KC's Workspace
    Preparing search index...

    Options for transforming a JavaScript or TypeScript file.

    transform

    interface TransformOptions {
        assumptions?: CompilerAssumptions;
        cwd?: string;
        decorator?: DecoratorOptions;
        define?: Record<string, string>;
        helpers?: Helpers;
        inject?: Record<string, string | [string, string]>;
        jsx?: "preserve" | JsxOptions;
        lang?: "dts" | "js" | "jsx" | "ts" | "tsx";
        plugins?: PluginsOptions;
        sourcemap?: boolean;
        sourceType?: "module" | "script" | "unambiguous";
        target?: string | string[];
        typescript?: TypeScriptOptions;
    }
    Index

    Properties

    assumptions?: CompilerAssumptions

    Set assumptions in order to produce smaller output.

    cwd?: string

    The current working directory. Used to resolve relative paths in other options.

    decorator?: DecoratorOptions

    Decorator plugin

    define?: Record<string, string>

    Define Plugin

    helpers?: Helpers

    Behaviour for runtime helpers.

    inject?: Record<string, string | [string, string]>

    Inject Plugin

    jsx?: "preserve" | JsxOptions

    Configure how TSX and JSX are transformed.

    lang?: "dts" | "js" | "jsx" | "ts" | "tsx"

    Treat the source text as js, jsx, ts, tsx, or dts.

    plugins?: PluginsOptions

    Third-party plugins to use.

    sourcemap?: boolean

    Enable source map generation.

    When true, the sourceMap field of transform result objects will be populated.

    false
    
    sourceType?: "module" | "script" | "unambiguous"

    Treat the source text as script or module code.

    target?: string | string[]

    Sets the target environment for the generated JavaScript.

    The lowest target is es2015.

    Example:

    • 'es2015'
    • ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']

    esnext (No transformation)

    typescript?: TypeScriptOptions

    Configure how TypeScript is transformed.