OptionaladvancedOptionalgroups?: {Groups to be used for advanced chunking.
OptionalincludeDependenciesRecursively?: booleanbooleantrueBy 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'strictExecutionOrder: trueto avoid generating invalid chunks.
OptionalmaxModuleSize?: numbernumberGlobal fallback of {group}.maxModuleSize, if it's not specified in the group.
OptionalmaxSize?: numbernumberGlobal fallback of {group}.maxSize, if it's not specified in the group.
OptionalminModuleSize?: numbernumberGlobal fallback of {group}.minModuleSize, if it's not specified in the group.
OptionalminShareCount?: numbernumberGlobal fallback of {group}.minShareCount, if it's not specified in the group.
OptionalminSize?: numbernumberGlobal fallback of {group}.minSize, if it's not specified in the group.
OptionalassetOptionalbannerOptionalchunkOptionalcleanbooleanfalseClean output directory before emitting output.
OptionalcssOptionalcssOptionaldirOptionalentryOptionalesOptionalexportsOptionalextendOptionalexternalOptionalfileOptionalfooterOptionalformatExpected 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.OptionalgeneratedOptionalglobalsOptionalhashOptionalhoistOptionalinlineOptionalintroOptionalkeepKeep function and class names after bundling.
When enabled, the bundler will preserve the original names of functions and classes in the output, which is useful for debugging and error stack traces.
OptionallegalControl comments in the output.
none: no commentsinline: preserve comments that contain @license, @preserve or starts with //! /*!Optionalmanual((moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue):::warning
advancedChunks instead.manualChunks and advancedChunks are both specified, manualChunks option will be ignored.
:::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
{
advancedChunks: {
groups: [
{
name(moduleId) {
if (moduleId.includes('node_modules')) {
return 'vendor';
}
return null;
},
},
],
}
}
OptionalminifyControl 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 settingsOptionalminifybooleantrue for format es or if output.minify is true or object, false otherwiseWhether to minify internal exports.
OptionalnameOptionaloutroOptionalpathsMaps 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.
OptionalpluginsOptionalpolyfillOptionalpostSimilar to banner option, but will run after the renderChunk hook and builtin minification.
OptionalpostSimilar to footer option, but will run after the renderChunk hook and builtin minification.
OptionalpreserveOptionalpreserveOptionalsanitizeOptionalsourcemapOptionalsourcemapOptionalsourcemapOptionalsourcemapControl 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 all source files in the ignore listtrue: Include no 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 (source: string, sourcemapPath: string) => boolean 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.');
}
default: /node_modules/
OptionalsourcemapOptionaltopOptionalvirtual
Allows you to do manual chunking. For deeper understanding, please refer to the in-depth documentation.