web-infra-dev / rspack

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

[Bug]: `cacheGroups` filename params with `maxSize` doesn't take effect #6440

Open abettadapur opened 1 month ago

abettadapur commented 1 month ago

System Info

System: All Version: RSPack 0.6.3

Details

I have the following cacheGroups configuration

  svg: {
          filename: 'svg-[contenthash].js',
          name: 'svg',
          chunks: 'all',
          maxSize: 100 * 1024,
          reuseExistingChunk: true,
          test: /.*\.svg/,
        },

With webpack, I get the following files

* svg-xxxxxx-yyyyyyy.js
* svg-aaaaaa-bbbbb.js
* ...

With RSPack, I get the following files

* svg-1.js
* svg-2.js
* ...
* svg-xxxxxx.js

I would expect [contentHash] to take effect here

Reproduce link

No response

Reproduce Steps

Add a cacheGroups entry, and set max size so multiple chunks are produced

See that [contentHash] is not respected

abettadapur commented 1 month ago

Actually, no part of the name configuration takes effect

EX:

  svg: {
          filename: 'svg-helloworld.js',
          name: 'svg',
          chunks: 'all',
          maxSize: 100 * 1024,
          reuseExistingChunk: true,
          test: /.*\.svg/,
        }

Produces

* svg-1.js
* svg-2.js
* ...
* svg-helloworld.js
SyMind commented 1 month ago

I could not reproduce this issue. Please provide a minimal reproduction repository. @abettadapur

abettadapur commented 1 month ago

Thanks for looking @SyMind . I'm on vacation right now, but can provide you a repro next week