OptionaladvancedOptionalassetThe 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.
OptionalbannerA string to prepend to the bundle before renderChunk hook.
See output.intro, output.postBanner as well.
OptionalchunkThe 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.
OptionalcleanClean output directory (output.dir) before emitting output.
OptionalcodeControls 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.
OptionalcommentsControl which comments are preserved in the output.
true: Preserve legal, annotation, and JSDoc comments (default)false: Strip all commentsNote: Regular line and block comments without these markers are always removed regardless of this option.
When both legalComments and comments.legal are set, comments.legal takes priority.
OptionaldirThe directory in which all generated chunks are placed.
The output.file option can be used instead if only a single chunk is generated.
OptionaldynamicWhether 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.
OptionalentryThe 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.
OptionalesWhether 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.OptionalexportsWhich exports mode to use.
OptionalextendOptionalexternalWhether 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.
OptionalfileThe file path for the single generated chunk.
The output.dir option should be used instead if multiple chunks are generated.
OptionalfooterA string to append to the bundle before renderChunk hook.
See output.outro, output.postFooter as well.
OptionalformatExpected 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.OptionalgeneratedWhich 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.
OptionalglobalsOptionalhashSpecify 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)OptionalinlineOptionalintroA string to prepend inside any format-specific wrapper.
See output.banner, output.postBanner as well.
OptionalkeepKeep 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.
OptionallegalControls how legal comments are preserved in the output.
none: no legal commentsinline: preserve legal comments that contain @license, @preserve or starts with //! /*!OptionalmanualAllows 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.
:::
OptionalminifyControl 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 eliminationfalse: Disable minification'dce-only': Only perform dead code elimination without code compression (default)MinifyOptions: Fine-grained control over minification settingsOptionalminifyWhether to minify internal exports as single letter variables to allow for better minification.
OptionalnameSpecifies the global variable name that contains the exports of umd / iife formats.
OptionaloutroA string to append inside any format-specific wrapper.
See output.footer, output.postFooter as well.
OptionalpathsMaps 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.
OptionalpluginsThe list of plugins to use only for this output.
OptionalpolyfillWhether to add a polyfill for require() function in non-CommonJS formats.
This option is useful when you want to inject your own require implementation.
OptionalpostA string to prepend to the bundle after renderChunk hook and minification.
See output.banner, output.intro as well.
OptionalpostA string to append to the bundle after renderChunk hook and minification.
See output.footer, output.outro as well.
OptionalpreserveWhether to use preserve modules mode.
OptionalpreserveA directory path to input modules that should be stripped away from output.dir when using preserve modules mode.
OptionalsanitizeWhether 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.
OptionalsourcemapWhether 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.OptionalsourcemapThe 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.
OptionalsourcemapWhether 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.
OptionalsourcemapControl 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:::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.');
}
OptionalsourcemapA transformation to apply to each path in a sourcemap.
OptionalstrictWhether to always output "use strict" directive in non-ES module outputs.
true - Always emit "use strict" at the top of the output (not applicable for ESM format since ESM is always strict).false - Never emit "use strict" in the output.'auto' - Respect the "use strict" directives from the source code.See In-depth directive guide for more details.
OptionalstrictLets 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.
Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
OptionaltopWhether 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.
OptionalvirtualSpecifies the directory name for "virtual" files that might be emitted by plugins when using preserve modules mode.
Deprecated
Please use
output.codeSplittinginstead.Allows you to do manual chunking.
:::warning If
advancedChunksandcodeSplittingare both specified,advancedChunksoption will be ignored. :::