Skip to content

Interface: OutputOptions

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:243

Properties

advancedChunks?

ts
optional advancedChunks: object;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:731

groups?

ts
optional groups: CodeSplittingGroup[];

includeDependenciesRecursively?

ts
optional includeDependenciesRecursively: boolean;

maxModuleSize?

ts
optional maxModuleSize: number;

maxSize?

ts
optional maxSize: number;

minModuleSize?

ts
optional minModuleSize: number;

minShareCount?

ts
optional minShareCount: number;

minSize?

ts
optional minSize: number;

Deprecated

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?

ts
optional assetFileNames: string | (chunkInfo) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:438

The pattern to use for naming custom emitted assets to include in the build output, or a function that is called per asset 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.

Default

ts
'assets/[name]-[hash][extname]'

ts
optional banner: string | (chunk) => string | Promise<string>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:369

A string to prepend to the bundle before renderChunk hook.

See output.intro, output.postBanner as well.

./docs/output-banner.md


chunkFileNames?

ts
optional chunkFileNames: string | (chunkInfo) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:468

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

Patterns support the following placeholders:

  • [format]: The rendering format defined in the output options, e.g. es or cjs.
  • [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.

Default

ts
'[name]-[hash].js'

cleanDir?

ts
optional cleanDir: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:810

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

Default

false

./docs/output-clean-dir.md


codeSplitting?

ts
optional codeSplitting: object;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:684

Allows you to do manual chunking. For deeper understanding, please refer to the in-depth documentation.

groups?

ts
optional groups: CodeSplittingGroup[];

Groups to be used for code splitting.

includeDependenciesRecursively?

ts
optional includeDependenciesRecursively: boolean;

By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks.

If you want to disable this behavior, it's recommended to both set

to avoid generating invalid chunks.

Default
ts
true

maxModuleSize?

ts
optional maxModuleSize: number;

Global fallback of group.maxModuleSize, if it's not specified in the group.

maxSize?

ts
optional maxSize: number;

Global fallback of group.maxSize, if it's not specified in the group.

minModuleSize?

ts
optional minModuleSize: number;

Global fallback of group.minModuleSize, if it's not specified in the group.

minShareCount?

ts
optional minShareCount: number;

Global fallback of group.minShareCount, if it's not specified in the group.

minSize?

ts
optional minSize: number;

Global fallback of group.minSize, if it's not specified in the group.

Example

Basic vendor chunk

js
export default defineConfig({
  output: {
    codeSplitting: {
      minSize: 20000,
      groups: [
        {
          name: 'vendor',
          test: /node_modules/,
        },
      ],
    },
  },
})

./docs/output-advanced-chunks.md


dir?

ts
optional dir: string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:251

The directory in which all generated chunks are placed.

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

Default

ts
'dist'

dynamicImportInCjs?

ts
optional dynamicImportInCjs: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:615

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.

Default

ts
true

entryFileNames?

ts
optional entryFileNames: string | (chunkInfo) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:453

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

Patterns support the following placeholders:

  • [format]: The rendering format defined in the output options, e.g. es or cjs.
  • [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.

Default

ts
'[name].js'

esModule?

ts
optional esModule: boolean | "if-default-prop";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:422

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.

Default

ts
'if-default-prop'

exports?

ts
optional exports: "default" | "auto" | "named" | "none";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:265

Which exports mode to use.

./docs/output-exports.md

Default

ts
'auto'

extend?

ts
optional extend: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:410

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 = {}.

Default

ts
false

externalLiveBindings?

ts
optional externalLiveBindings: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:598

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.

Default

true

./docs/output-external-live-bindings.md


file?

ts
optional file: string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:257

The file path for the single generated chunk.

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


ts
optional footer: string | (chunk) => string | Promise<string>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:377

A string to append to the bundle before renderChunk hook.

See output.outro, output.postFooter as well.

./docs/output-footer.md


format?

ts
optional format: "es" | "cjs" | "iife" | "umd" | "module" | "commonjs" | "esm";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:286

Expected format of generated code.

Default

ts
'esm'

generatedCode?

ts
optional generatedCode: Partial<GeneratedCodeOptions>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:586

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?

ts
optional globals: Record<string, string> | (name) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:549

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

Example

js
export default defineConfig({
  external: ['jquery'],
  output: {
    format: 'iife',
    name: 'MyBundle',
    globals: {
      jquery: '$',
    },
  },
})
js
// input
import $ from 'jquery'
js
// output
var MyBundle = (function ($) {
  // ...
})($)

hashCharacters?

ts
optional hashCharacters: "base64" | "hex" | "base36";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:275

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)

Default

ts
'base64'

inlineDynamicImports?

ts
optional inlineDynamicImports: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:606

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.

Default

ts
false

intro?

ts
optional intro: string | (chunk) => string | Promise<string>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:395

A string to prepend inside any format-specific wrapper.

See output.banner, output.postBanner as well.


keepNames?

ts
optional keepNames: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:820

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.

Default

ts
false

legalComments?

ts
optional legalComments: "inline" | "none";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:746

Control comments in the output.

  • none: no comments
  • inline: preserve comments that contain @license, @preserve or starts with //! /*!

manualChunks()?

ts
optional manualChunks: (moduleId, meta) => string | NullValue<void>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:661

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

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

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

will be transformed to

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

Note that unlike Rollup, object form is not supported.

Parameters

moduleId

string

meta
getModuleInfo

(moduleId) => ModuleInfo | null

Returns

string | NullValue<void>

Deprecated

Please use output.codeSplitting instead.

WARNING

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


minify?

ts
optional minify:
  | boolean
  | MinifyOptions
  | "dce-only";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:499

Control code minification.

  • 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

Default

ts
false

minifyInternalExports?

ts
optional minifyInternalExports: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:802

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

Default

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

./docs/output-minify-internal-exports.md


name?

ts
optional name: string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:521

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

Example

js
export default defineConfig({
  output: {
    format: 'iife',
    name: 'MyBundle',
  },
})
js
// output
var MyBundle = (function () {
  // ...
})()

./docs/output-name.md


outro?

ts
optional outro: string | (chunk) => string | Promise<string>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:401

A string to append inside any format-specific wrapper.

See output.footer, output.postFooter as well.


paths?

ts
optional paths: Record<string, string> | (id) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:580

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

Examples

js
{
  paths: {
    'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
  }
}
js
{
  paths: (id) => {
    if (id.startsWith('lodash')) {
      return `https://cdn.jsdelivr.net/npm/${id}`
    }
    return id
  }
}

plugins?

ts
optional plugins: RolldownOutputPluginOption;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:750

The list of plugins to use only for this output.


polyfillRequire?

ts
optional polyfillRequire: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:758

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.

Default

ts
true

postBanner?

ts
optional postBanner: string | (chunk) => string | Promise<string>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:383

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

See output.banner, output.intro as well.


postFooter?

ts
optional postFooter: string | (chunk) => string | Promise<string>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:389

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

See output.footer, output.outro as well.


preserveModules?

ts
optional preserveModules: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:771

Whether to use preserve modules mode.

./docs/output-preserve-modules.md

Default

ts
false

preserveModulesRoot?

ts
optional preserveModulesRoot: string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:783

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

./docs/output-preserve-modules-root.md


sanitizeFileName?

ts
optional sanitizeFileName: boolean | (name) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:488

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.

Default

ts
true

sourcemap?

ts
optional sourcemap: boolean | "hidden" | "inline";

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:297

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.

Default

ts
false

sourcemapBaseUrl?

ts
optional sourcemapBaseUrl: string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:303

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?

ts
optional sourcemapDebugIds: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:311

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.

Default

ts
false

sourcemapIgnoreList?

ts
optional sourcemapIgnoreList:
  | boolean
  | StringOrRegExp
  | (relativeSourcePath, sourcemapPath) => boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:344

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

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.

Example

js
// ✅ 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.')
}

Default

ts
;/node_modules/

sourcemapPathTransform()?

ts
optional sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:361

A transformation to apply to each path in a sourcemap.

Parameters

relativeSourcePath

string

sourcemapPath

string

Returns

string

Example

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

topLevelVar?

ts
optional topLevelVar: boolean;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:793

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.

Default

false

./docs/output-top-level-var.md


virtualDirname?

ts
optional virtualDirname: string;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.60/node_modules/rolldown/dist/shared/define-config-BgCyRzGF.d.mts:777

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

Default

ts
'_virtual'

Released under the MIT License.