Home > @lynx-js/rspeedy > ChunkSplitCustom > splitChunks

ChunkSplitCustom.splitChunks property

Custom Rspack chunk splitting config can be specified.

Signature:

splitChunks?: Rspack.Configuration extends {
        optimization?: {
            splitChunks?: infer P;
        } | undefined;
    } ? P : never;

Example

  • Split @lynx-js/react and react-router into chunk lib-react.
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  performance: {
    chunkSplit: {
      strategy: 'custom',
      splitChunks: {
        cacheGroups: {
          react: {
            test: /node_modules[\\/](@lynx-js[\\/]react|react-router)[\\/]/,
            name: 'lib-react',
            chunks: 'all',
          },
        },
      },
    },
  },
})
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.