performance.chunkSplit

    • 类型: Object
    • 默认值: { strategy: 'split-by-experience' }

    performance.chunkSplit 用于配置 Modern.js 的拆包策略。配置项的类型 ChunkSplit 如下:

    type ForceSplitting = RegExp[] | Record<string, RegExp>;
    
    interface BaseChunkSplit {
      strategy?:
        | 'split-by-module'
        | 'split-by-experience'
        | 'all-in-one'
        | 'single-vendor';
      override?: SplitChunks;
      forceSplitting?: ForceSplitting;
    }
    
    interface SplitBySize {
      strategy?: 'split-by-size';
      minSize?: number;
      maxSize?: number;
      override?: SplitChunks;
      forceSplitting?: ForceSplitting;
    }
    
    interface SplitCustom {
      strategy?: 'custom';
      splitChunks?: SplitChunks;
      forceSplitting?: ForceSplitting;
    }
    
    export type ChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
    INFO

    该配置项的使用方式与 Rsbuild 完全一致。详细信息请参考 Rsbuild - performance.chunkSplit