web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
8.56k stars 503 forks source link

`splitChunks` package same bundle multiple times #4386

Closed ZLY201 closed 9 months ago

ZLY201 commented 10 months ago

System Info

System:
    OS: macOS 13.5.2
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.12.1 - /opt/homebrew/bin/npm
    pnpm: 8.6.2 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 118.0.5993.88
    Safari: 16.6
  npmPackages:
    @rspack/cli: ^0.3.5 => 0.3.7

Details

image

Reproduce link

No response

Reproduce Steps

// rspack.config.js
module.exports = {
  ...
  optimization: {
    splitChunks: {
      chunks: 'all',
      minChunks: 1,
      minSize: 500 * 1024,
      maxSize: 1000 * 1024,
      maxAsyncRequests: 30,
      maxInitialRequests: 30,
      cacheGroups: {
        monaco: {
          chunks: 'async',
          test: /[\\/]node_modules[\\/]monaco-editor/,
          priority: 1000,
          name: 'monaco',
          reuseExistingChunk: true,
        },
        common: {
          chunks: 'all',
          test: /[\\/]node_modules[\\/](react|react-dom|@arco-design[\\/]web-react)/,
          priority: 100,
          name: 'common',
          reuseExistingChunk: true,
        },
        vendors: {
          chunks: 'all',
          test: /[\\/]node_modules[\\/]/,
          priority: 10,
          name: 'vendors',
          reuseExistingChunk: true,
        },
        async: {
          chunks: 'async',
          priority: 1,
          name: 'async',
          reuseExistingChunk: true,
        },
      },
    },
  },
  ...
}
JSerFeng commented 10 months ago

Could you provide a minimal repro repo ?

github-actions[bot] commented 9 months ago

Hello @ZLY201, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.