KC's Workspace
    Preparing search index...

    Options for transforming a code.

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

    Hierarchy (View Summary)

    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

    inputMap?: SourceMap

    An input source map to collapse with the output source map.

    jsx?: "preserve" | JsxOptions

    Configure how TSX and JSX are transformed.

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

    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?: "script" | "module" | "commonjs" | "unambiguous"

    Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'.

    target?: string | string[]

    Sets the target environment for the generated JavaScript.

    The lowest target is es2015.

    Example:

    • 'es2015'
    • ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
    tsconfig?: boolean | BindingTsconfigRawOptions

    Configure tsconfig handling.

    • true: Auto-discover and load the nearest tsconfig.json
    • TsconfigRawOptions: Use the provided inline tsconfig options
    typescript?: TypeScriptOptions

    Configure how TypeScript is transformed.