advancedChunks
- Type:
optionaladvancedChunks:object
Allows you to do manual chunking. For deeper understanding, please refer to the in-depth documentation.
groups?
- Type:
optionalgroups:AdvancedChunksGroup[]
Groups to be used for advanced chunking.
includeDependenciesRecursively?
- Type:
optionalincludeDependenciesRecursively: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?
- Type:
optionalmaxModuleSize:number
Global fallback of group.maxModuleSize, if it's not specified in the group.
maxSize?
- Type:
optionalmaxSize:number
Global fallback of group.maxSize, if it's not specified in the group.
minModuleSize?
- Type:
optionalminModuleSize:number
Global fallback of group.minModuleSize, if it's not specified in the group.
minShareCount?
- Type:
optionalminShareCount:number
Global fallback of group.minShareCount, if it's not specified in the group.
minSize?
- Type:
optionalminSize:number
Global fallback of group.minSize, if it's not specified in the group.
Example
Basic vendor chunk
export default defineConfig({
output: {
advancedChunks: {
minSize: 20000,
groups: [
{
name: 'vendor',
test: /node_modules/,
},
],
},
},
});Multiple chunk groups with priorities
export default defineConfig({
output: {
advancedChunks: {
groups: [
{
name: 'react-vendor',
test: /node_modules[\\/]react/,
priority: 20,
},
{
name: 'ui-vendor',
test: /node_modules[\\/](antd%7C@mui)/,
priority: 15,
},
{
name: 'vendor',
test: /node_modules/,
priority: 10,
},
{
name: 'common',
minShareCount: 2,
minSize: 10000,
priority: 5,
},
],
},
},
});Size-based splitting
export default defineConfig({
output: {
advancedChunks: {
groups: [
{
name: 'large-libs',
test: /node_modules/,
minSize: 100000, // 100KB
maxSize: 250000, // 250KB
priority: 10,
},
],
},
},
});