Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Build with chunkSplit.override didn't work if key is module name. #3786

Closed
Cheese-Yu opened this issue Oct 21, 2024 · 2 comments · Fixed by #3886 or #3887
Closed

[Bug]: Build with chunkSplit.override didn't work if key is module name. #3786

Cheese-Yu opened this issue Oct 21, 2024 · 2 comments · Fixed by #3886 or #3887
Labels
🐞 bug Something isn't working

Comments

@Cheese-Yu
Copy link
Contributor

Version

System:
OS: macOS 12.5.1
CPU: (8) arm64 Apple M1 Pro
Memory: 102.58 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Browsers:
Chrome: 129.0.6668.101
Edge: 130.0.2849.46
Safari: 15.6.1
npmPackages:
@rsbuild/core: ^1.0.1 => 1.0.16
@rsbuild/plugin-vue: ^1.0.1 => 1.0.2

Details

  1. 'vue' rule is not ok, but 'vendors' rule is ok.
    chunkSplit: {
      override: {
        chunks: 'all',
        minSize: 30000,
        cacheGroups: {
          vue: {
            name: 'vue-common',
            test: /[\\/]node_modules[\\/](vue|vue-router|vue-i18n|pinia)[\\/]/,
            priority: 100,
          },
          vendors: {
            name: 'my-chunk-vendors',
            test: /[\\/]node_modules[\\/]/,
            priority: 20,
          },
        },
      },
    },
  1. Add strategy: 'custom', 'vue' rule is ok, 'vendors' rule is ok too.
    chunkSplit: {
      strategy: 'custom'
      override: {
        chunks: 'all',
        minSize: 30000,
        cacheGroups: {
          vue: {
            name: 'vue-common',
            test: /[\\/]node_modules[\\/](vue|vue-router|vue-i18n|pinia)[\\/]/,
            priority: 100,
          },
          vendors: {
            name: 'my-chunk-vendors',
            test: /[\\/]node_modules[\\/]/,
            priority: 20,
          },
        },
      },
    },

Reproduce link

https://github.com/Cheese-Yu/rsbuid-reproduction-mini-repo

Reproduce Steps

run npm run build

@Cheese-Yu Cheese-Yu added the 🐞 bug Something isn't working label Oct 21, 2024
@Cheese-Yu Cheese-Yu changed the title [Bug]: Build with chunkSplit.override didn't work in some rules. [Bug]: Build with chunkSplit.override didn't work if key is module name. Oct 21, 2024
@chenjiahan
Copy link
Member

Hi, what's the expected build result, can you elaborate?

@Cheese-Yu
Copy link
Contributor Author

Hi, what's the expected build result, can you elaborate?

If use rule:

  vue: {
    name: 'vue-common',
    test: /[\\/]node_modules[\\/](vue|vue-router|vue-i18n|pinia)[\\/]/,
    priority: 100,
  }

build result should contain a file: vue-common.[hash].js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
2 participants