KC's Workspace
    Preparing search index...
    interface OutputOptions {
        advancedChunks?: {
            groups?: CodeSplittingGroup[];
            includeDependenciesRecursively?: boolean;
            maxModuleSize?: number;
            maxSize?: number;
            minModuleSize?: number;
            minShareCount?: number;
            minSize?: number;
        };
        assetFileNames?: string
        | ((chunkInfo: PreRenderedAsset) => string);
        banner?: string | ((chunk: RenderedChunk) => string | Promise<string>);
        chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
        cleanDir?: boolean;
        codeSplitting?: boolean | CodeSplittingOptions;
        dir?: string;
        dynamicImportInCjs?: boolean;
        entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
        esModule?: boolean | "if-default-prop";
        exports?: "auto" | "named" | "default" | "none";
        extend?: boolean;
        externalLiveBindings?: boolean;
        file?: string;
        footer?: string | ((chunk: RenderedChunk) => string | Promise<string>);
        format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
        generatedCode?: Partial<GeneratedCodeOptions>;
        globals?: Record<string, string> | ((name: string) => string);
        hashCharacters?: "base64" | "base36" | "hex";
        inlineDynamicImports?: boolean;
        intro?: string | ((chunk: RenderedChunk) => string | Promise<string>);
        keepNames?: boolean;
        legalComments?: "inline" | "none";
        manualChunks?: (
            moduleId: string,
            meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null },
        ) => string | undefined | null | void;
        minify?: boolean | "dce-only" | MinifyOptions;
        minifyInternalExports?: boolean;
        name?: string;
        outro?: string | ((chunk: RenderedChunk) => string | Promise<string>);
        paths?: Record<string, string> | ((id: string) => string);
        plugins?: RolldownOutputPluginOption;
        polyfillRequire?: boolean;
        postBanner?: string | ((chunk: RenderedChunk) => string | Promise<string>);
        postFooter?: string | ((chunk: RenderedChunk) => string | Promise<string>);
        preserveModules?: boolean;
        preserveModulesRoot?: string;
        sanitizeFileName?: boolean | ((name: string) => string);
        sourcemap?: boolean | "inline" | "hidden";
        sourcemapBaseUrl?: string;
        sourcemapDebugIds?: boolean;
        sourcemapIgnoreList?:
            | boolean
            | ((relativeSourcePath: string, sourcemapPath: string) => boolean)
            | string | RegExp;
        sourcemapPathTransform?: (
            relativeSourcePath: string,
            sourcemapPath: string,
        ) => string;
        strictExecutionOrder?: boolean;
        topLevelVar?: boolean;
        virtualDirname?: string;
    }
    Index

    Properties

    advancedChunks?: {
        groups?: CodeSplittingGroup[];
        includeDependenciesRecursively?: boolean;
        maxModuleSize?: number;
        maxSize?: number;
        minModuleSize?: number;
        minShareCount?: number;
        minSize?: number;
    }

    Please use output.codeSplitting instead.

    Allows you to do manual chunking.

    :::warning If advancedChunks and codeSplitting are both specified, advancedChunks option will be ignored. :::

    assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string)

    The pattern to use for naming custom emitted assets to include in the build output, or a function that is called per asset with PreRenderedAsset to return such a pattern.

    Patterns support the following placeholders:

    • [extname]: The file extension of the asset including a leading dot, e.g. .css.
    • [ext]: The file extension without a leading dot, e.g. css.
    • [hash]: A hash based on the content of the asset. You can also set a specific hash length via e.g. [hash:10]. By default, it will create a base-64 hash. If you need a reduced character set, see output.hashCharacters.
    • [name]: The file name of the asset excluding any extension.

    Forward slashes (/) can be used to place files in sub-directories.

    See also output.chunkFileNames, output.entryFileNames.

    'assets/[name]-[hash][extname]'
    
    banner?: string | ((chunk: RenderedChunk) => string | Promise<string>)

    A string to prepend to the bundle before renderChunk hook.

    See output.intro, output.postBanner as well.

    chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string)

    The pattern to use for naming shared chunks created when code-splitting, or a function that is called per chunk with PreRenderedChunk to return such a pattern.

    Patterns support the following placeholders:

    • [format]: The rendering format defined in the output options. The value is any of InternalModuleFormat.
    • [hash]: A hash based only on the content of the final generated chunk, including transformations in renderChunk and any referenced file hashes. You can also set a specific hash length via e.g. [hash:10]. By default, it will create a base-64 hash. If you need a reduced character set, see output.hashCharacters.
    • [name]: The name of the chunk. This can be explicitly set via the output.codeSplitting option or when the chunk is created by a plugin via this.emitFile. Otherwise, it will be derived from the chunk contents.

    Forward slashes (/) can be used to place files in sub-directories.

    See also output.assetFileNames, output.entryFileNames.

    '[name]-[hash].js'
    
    cleanDir?: boolean

    Clean output directory (output.dir) before emitting output.

    false
    
    codeSplitting?: boolean | CodeSplittingOptions

    Controls how code splitting is performed.

    • true: Default behavior, automatic code splitting. (default)
    • false: Inline all dynamic imports into a single bundle (equivalent to deprecated inlineDynamicImports: true).
    • object: Advanced manual code splitting configuration.

    For deeper understanding, please refer to the in-depth documentation.

    Basic vendor chunk

    export default defineConfig({
    output: {
    codeSplitting: {
    minSize: 20000,
    groups: [
    {
    name: 'vendor',
    test: /node_modules/,
    },
    ],
    },
    },
    });
    true
    
    dir?: string

    The directory in which all generated chunks are placed.

    The output.file option can be used instead if only a single chunk is generated.

    'dist'
    
    dynamicImportInCjs?: boolean

    Whether to keep external dynamic imports as import(...) expressions in CommonJS output.

    If set to false, external dynamic imports will be rewritten to use require(...) calls. This may be necessary to support environments that do not support dynamic import() in CommonJS modules like old Node.js versions.

    true
    
    entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string)

    The pattern to use for chunks created from entry points, or a function that is called per entry chunk with PreRenderedChunk to return such a pattern.

    Patterns support the following placeholders:

    • [format]: The rendering format defined in the output options. The value is any of InternalModuleFormat.
    • [hash]: A hash based only on the content of the final generated chunk, including transformations in renderChunk and any referenced file hashes. You can also set a specific hash length via e.g. [hash:10]. By default, it will create a base-64 hash. If you need a reduced character set, see output.hashCharacters.
    • [name]: The file name (without extension) of the entry point, unless the object form of input was used to define a different name.

    Forward slashes (/) can be used to place files in sub-directories. This pattern will also be used for every file when setting the output.preserveModules option.

    See also output.assetFileNames, output.chunkFileNames.

    '[name].js'
    
    esModule?: boolean | "if-default-prop"

    Whether to add a __esModule: true property when generating exports for non-ES formats.

    This property signifies that the exported value is the namespace of an ES module and that the default export of this module corresponds to the .default property of the exported object.

    • true: Always add the property when using named exports mode, which is similar to what other tools do.
    • "if-default-prop": Only add the property when using named exports mode and there also is a default export. The subtle difference is that if there is no default export, consumers of the CommonJS version of your library will get all named exports as default export instead of an error or undefined.
    • false: Never add the property even if the default export would become a property .default.
    'if-default-prop'
    
    exports?: "auto" | "named" | "default" | "none"

    Which exports mode to use.

    'auto'
    
    extend?: boolean

    Whether to extend the global variable defined by the name option in umd or iife formats.

    When true, the global variable will be defined as global.name = global.name || {}. When false, the global defined by name will be overwritten like global.name = {}.

    false
    
    externalLiveBindings?: boolean

    Whether to generate code to support live bindings for external imports.

    With the default value of true, Rolldown will generate code to support live bindings for external imports.

    When set to false, Rolldown will assume that exports from external modules do not change. This will allow Rolldown to generate smaller code. Note that this can cause issues when there are circular dependencies involving an external dependency.

    true
    
    file?: string

    The file path for the single generated chunk.

    The output.dir option should be used instead if multiple chunks are generated.

    footer?: string | ((chunk: RenderedChunk) => string | Promise<string>)

    A string to append to the bundle before renderChunk hook.

    See output.outro, output.postFooter as well.

    format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd"

    Expected format of generated code.

    'esm'
    
    generatedCode?: Partial<GeneratedCodeOptions>

    Which language features Rolldown can safely use in generated code.

    This will not transpile any user code but only change the code Rolldown uses in wrappers and helpers.

    globals?: Record<string, string> | ((name: string) => string)

    Specifies id: variableName pairs necessary for external imports in umd / iife formats.

    export default defineConfig({
    external: ['jquery'],
    output: {
    format: 'iife',
    name: 'MyBundle',
    globals: {
    jquery: '$',
    }
    }
    });
    // input
    import $ from 'jquery';
    // output
    var MyBundle = (function ($) {
    // ...
    })($);
    hashCharacters?: "base64" | "base36" | "hex"

    Specify the character set that Rolldown is allowed to use in file hashes.

    • 'base64': Uses url-safe base64 characters (0-9, a-z, A-Z, -, _). This will produce the shortest hashes.
    • 'base36': Uses alphanumeric characters (0-9, a-z)
    • 'hex': Uses hexadecimal characters (0-9, a-f)
    'base64'
    
    inlineDynamicImports?: boolean

    Please use codeSplitting: false instead.

    Whether to inline dynamic imports instead of creating new chunks to create a single bundle.

    This option can be used only when a single input is provided.

    false
    
    intro?: string | ((chunk: RenderedChunk) => string | Promise<string>)

    A string to prepend inside any format-specific wrapper.

    See output.banner, output.postBanner as well.

    keepNames?: boolean

    Keep name property of functions and classes after bundling.

    When enabled, the bundler will preserve the original name property value of functions and classes in the output. This is useful for debugging and some frameworks that rely on it for registration and binding purposes.

    false
    
    legalComments?: "inline" | "none"

    Control comments in the output.

    • none: no comments
    • inline: preserve comments that contain @license, @preserve or starts with //! /*!
    manualChunks?: (
        moduleId: string,
        meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null },
    ) => string | undefined | null | void

    Allows you to do manual chunking. Provided for Rollup compatibility.

    You could use this option for migration purpose. Under the hood,

    {
    manualChunks: (moduleId, meta) => {
    if (moduleId.includes('node_modules')) {
    return 'vendor';
    }
    return null;
    }
    }

    will be transformed to

    {
    codeSplitting: {
    groups: [
    {
    name(moduleId) {
    if (moduleId.includes('node_modules')) {
    return 'vendor';
    }
    return null;
    },
    },
    ],
    }
    }

    Note that unlike Rollup, object form is not supported.

    Please use output.codeSplitting instead.

    :::warning If manualChunks and codeSplitting are both specified, manualChunks option will be ignored. :::

    minify?: boolean | "dce-only" | MinifyOptions

    Control code minification

    Rolldown uses Oxc Minifier under the hood. See Oxc's minification documentation for more details.

    • true: Enable full minification including code compression and dead code elimination
    • false: Disable minification (default)
    • 'dce-only': Only perform dead code elimination without code compression
    • MinifyOptions: Fine-grained control over minification settings
    false
    
    minifyInternalExports?: boolean

    Whether to minify internal exports as single letter variables to allow for better minification.

    true for format es or if output.minify is true or object, false otherwise

    name?: string

    Specifies the global variable name that contains the exports of umd / iife formats.

    export default defineConfig({
    output: {
    format: 'iife',
    name: 'MyBundle',
    }
    });
    // output
    var MyBundle = (function () {
    // ...
    })();
    outro?: string | ((chunk: RenderedChunk) => string | Promise<string>)

    A string to append inside any format-specific wrapper.

    See output.footer, output.postFooter as well.

    paths?: Record<string, string> | ((id: string) => string)

    Maps external module IDs to paths.

    Allows customizing the path used when importing external dependencies. This is particularly useful for loading dependencies from CDNs or custom locations.

    • Object form: Maps module IDs to their replacement paths
    • Function form: Takes a module ID and returns its replacement path
    {
    paths: {
    'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
    }
    }
    {
    paths: (id) => {
    if (id.startsWith('lodash')) {
    return `https://cdn.jsdelivr.net/npm/${id}`
    }
    return id
    }
    }

    The list of plugins to use only for this output.

    polyfillRequire?: boolean

    Whether to add a polyfill for require() function in non-CommonJS formats.

    This option is useful when you want to inject your own require implementation.

    true
    
    postBanner?: string | ((chunk: RenderedChunk) => string | Promise<string>)

    A string to prepend to the bundle after renderChunk hook and minification.

    See output.banner, output.intro as well.

    postFooter?: string | ((chunk: RenderedChunk) => string | Promise<string>)

    A string to append to the bundle after renderChunk hook and minification.

    See output.footer, output.outro as well.

    preserveModules?: boolean

    Whether to use preserve modules mode.

    false
    
    preserveModulesRoot?: string

    A directory path to input modules that should be stripped away from output.dir when using preserve modules mode.

    sanitizeFileName?: boolean | ((name: string) => string)

    Whether to enable chunk name sanitization (removal of non-URL-safe characters like \0, ? and *).

    Set false to disable the sanitization. You can also provide a custom sanitization function.

    true
    
    sourcemap?: boolean | "inline" | "hidden"

    Whether to generate sourcemaps.

    • false: No sourcemap will be generated.
    • true: A separate sourcemap file will be generated.
    • 'inline': The sourcemap will be appended to the output file as a data URL.
    • 'hidden': A separate sourcemap file will be generated, but the link to the sourcemap (//# sourceMappingURL comment) will not be included in the output file.
    false
    
    sourcemapBaseUrl?: string

    The base URL for the links to the sourcemap file in the output file.

    By default, relative URLs are generated. If this option is set, an absolute URL with that base URL will be generated. This is useful when deploying source maps to a different location than your code, such as a CDN or separate debugging server.

    sourcemapDebugIds?: boolean

    Whether to include debug IDs in the sourcemap.

    When true, a unique debug ID will be emitted in source and sourcemaps which streamlines identifying sourcemaps across different builds.

    false
    
    sourcemapIgnoreList?:
        | boolean
        | ((relativeSourcePath: string, sourcemapPath: string) => boolean)
        | string | RegExp

    Control which source files are included in the sourcemap ignore list.

    Files in the ignore list are excluded from debugger stepping and error stack traces.

    • false: Include no source files in the ignore list
    • true: Include all source files in the ignore list
    • string: Files containing this string in their path will be included in the ignore list
    • RegExp: Files matching this regular expression will be included in the ignore list
    • function: Custom function to determine if a source should be ignored

    :::tip Performance Using static values (boolean, string, or RegExp) is significantly more performant than functions. Calling JavaScript functions from Rust has extremely high overhead, so prefer static patterns when possible. :::

    // ✅ Preferred: Use RegExp for better performance
    sourcemapIgnoreList: /node_modules/

    // ✅ Preferred: Use string pattern for better performance
    sourcemapIgnoreList: "vendor"

    // ! Use sparingly: Function calls have high overhead
    sourcemapIgnoreList: (source, sourcemapPath) => {
    return source.includes('node_modules') || source.includes('.min.');
    }
    /node_modules/
    
    sourcemapPathTransform?: (
        relativeSourcePath: string,
        sourcemapPath: string,
    ) => string

    A transformation to apply to each path in a sourcemap.

    export default defineConfig({
    output: {
    sourcemap: true,
    sourcemapPathTransform: (source, sourcemapPath) => {
    // Remove 'src/' prefix from all source paths
    return source.replace(/^src//, '');
    },
    },
    });
    strictExecutionOrder?: boolean

    Lets modules be executed in the order they are declared.

    This is done by injecting runtime helpers to ensure that modules are executed in the order they are imported. External modules won't be affected.

    Warning

    Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.

    false
    
    topLevelVar?: boolean

    Whether to use var declarations at the top level scope instead of function / class / let / const expressions.

    Enabling this option can improve runtime performance of the generated code in certain environments.

    false
    
    virtualDirname?: string

    Specifies the directory name for "virtual" files that might be emitted by plugins when using preserve modules mode.

    '_virtual'