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]: Documentation provides invalid configuration for splitChunks.cacheGroups #8993

Open
Bilge opened this issue Jan 12, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@Bilge
Copy link

Bilge commented Jan 12, 2025

System Info

  System:
    OS: Linux 5.15 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Memory: 8.62 GB / 11.69 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 22.12.0 - /run/user/1000/fnm_multishells/106225_1736510454054/bin/node
    Yarn: 1.22.22 - /run/user/1000/fnm_multishells/106225_1736510454054/bin/yarn
    npm: 10.9.0 - /run/user/1000/fnm_multishells/106225_1736510454054/bin/npm
    pnpm: 10.0.0 - ~/.local/share/pnpm/pnpm
  npmPackages:
    @rspack/cli: ^1.1.8 => 1.1.8
    @rspack/core: ^1.1.8 => 1.1.8

Details

module.exports = {
  optimization: {
    splitChunks: {
      cacheGroups: {
        test: /\/some-lib\//,
        name: 'lib',
      },
    },
  },
};
[rspack-cli] [Error:   × TypeError: Method RegExp.prototype.test called on incompatible receiver undefined
  │     at test (<anonymous>)
  │     at /home/php/Club 250/node_modules/.pnpm/@[email protected]/node_modules/@rspack/core/dist/index.js:12370:16
  │ 
] {
  code: 'GenericFailure'
}
 ELIFECYCLE  Command failed with exit code 2.

Reproduce link

https://rspack.dev/guide/optimization/code-splitting#force-the-splitting-of-certain-modules

Reproduce Steps

Follow documentation for Force the splitting of certain modules.

@Bilge Bilge added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jan 12, 2025
@Bilge Bilge changed the title [Bug]: Documentation provides invlad configuration for splitChunks.cacheGroups [Bug]: Documentation provides invalid configuration for splitChunks.cacheGroups Jan 12, 2025
@Bilge
Copy link
Author

Bilge commented Jan 12, 2025

It seems the content of cacheGroups must be wrapped in an object with a key of arbitrary name.

@JSerFeng
Copy link
Contributor

JSerFeng commented Jan 13, 2025

Thanks, would you be willing to fix ?

@Bilge
Copy link
Author

Bilge commented Jan 13, 2025

@JSerFeng I cannot currently use rspack because of #8992. If that is fixed then I would be willing to amend the documentation 👍🏻

@chenjiahan chenjiahan removed the pending triage The issue/PR is currently untouched. label Jan 13, 2025
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
Development

No branches or pull requests

3 participants