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?
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?
optional groups: CodeSplittingGroup[];includeDependenciesRecursively?
optional includeDependenciesRecursively: boolean;maxModuleSize?
optional maxModuleSize: number;maxSize?
optional maxSize: number;minModuleSize?
optional minModuleSize: number;minShareCount?
optional minShareCount: number;minSize?
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?
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, seeoutput.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
'assets/[name]-[hash][extname]'banner?
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?
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.esorcjs.[hash]: A hash based only on the content of the final generated chunk, including transformations inrenderChunkand 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, seeoutput.hashCharacters.[name]: The name of the chunk. This can be explicitly set via theoutput.codeSplittingoption or when the chunk is created by a plugin viathis.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
'[name]-[hash].js'cleanDir?
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?
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?
optional groups: CodeSplittingGroup[];Groups to be used for code splitting.
includeDependenciesRecursively?
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
preserveEntrySignatures:false | 'allow-extension'experimental.strictExecutionOrder:true
to avoid generating invalid chunks.
Default
truemaxModuleSize?
optional maxModuleSize: number;Global fallback of group.maxModuleSize, if it's not specified in the group.
maxSize?
optional maxSize: number;Global fallback of group.maxSize, if it's not specified in the group.
minModuleSize?
optional minModuleSize: number;Global fallback of group.minModuleSize, if it's not specified in the group.
minShareCount?
optional minShareCount: number;Global fallback of group.minShareCount, if it's not specified in the group.
minSize?
optional minSize: number;Global fallback of group.minSize, if it's not specified in the group.
Example
Basic vendor chunk
export default defineConfig({
output: {
codeSplitting: {
minSize: 20000,
groups: [
{
name: 'vendor',
test: /node_modules/,
},
],
},
},
})./docs/output-advanced-chunks.md
dir?
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
'dist'dynamicImportInCjs?
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
trueentryFileNames?
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.esorcjs.[hash]: A hash based only on the content of the final generated chunk, including transformations inrenderChunkand 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, seeoutput.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
'[name].js'esModule?
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 orundefined.false: Never add the property even if the default export would become a property.default.
Default
'if-default-prop'exports?
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
'auto'extend?
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
falseexternalLiveBindings?
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?
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.
footer?
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?
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.
'es','esm'and'module'are the same format, all stand for ES module.'cjs'and'commonjs'are the same format, all stand for CommonJS module.'iife'stands for Immediately Invoked Function Expression.'umd'stands for Universal Module Definition.
Default
'esm'generatedCode?
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?
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
export default defineConfig({
external: ['jquery'],
output: {
format: 'iife',
name: 'MyBundle',
globals: {
jquery: '$',
},
},
})// input
import $ from 'jquery'// output
var MyBundle = (function ($) {
// ...
})($)hashCharacters?
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
'base64'inlineDynamicImports?
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
falseintro?
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?
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
falselegalComments?
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 commentsinline: preserve comments that contain@license,@preserveor starts with//!/*!
manualChunks()?
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,
{
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.
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?
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 eliminationfalse: Disable minification (default)'dce-only': Only perform dead code elimination without code compressionMinifyOptions: Fine-grained control over minification settings
Default
falseminifyInternalExports?
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?
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
export default defineConfig({
output: {
format: 'iife',
name: 'MyBundle',
},
})// output
var MyBundle = (function () {
// ...
})()./docs/output-name.md
outro?
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?
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
{
paths: {
'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
}
}{
paths: (id) => {
if (id.startsWith('lodash')) {
return `https://cdn.jsdelivr.net/npm/${id}`
}
return id
}
}plugins?
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?
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
truepostBanner?
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?
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?
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
falsepreserveModulesRoot?
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?
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
truesourcemap?
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 (//# sourceMappingURLcomment) will not be included in the output file.
Default
falsesourcemapBaseUrl?
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?
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
falsesourcemapIgnoreList?
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 listtrue: Include all source files in the ignore liststring: Files containing this string in their path will be included in the ignore listRegExp: Files matching this regular expression will be included in the ignore listfunction: 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
// ✅ 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
;/node_modules/sourcemapPathTransform()?
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
export default defineConfig({
output: {
sourcemap: true,
sourcemapPathTransform: (source, sourcemapPath) => {
// Remove 'src/' prefix from all source paths
return source.replace(/^src//, '');
},
},
});topLevelVar?
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?
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
'_virtual'