rspack icon indicating copy to clipboard operation
rspack copied to clipboard

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

Open abettadapur opened this issue 1 year ago • 7 comments

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 avatar May 05 '24 19:05 abettadapur

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

abettadapur avatar May 05 '24 19:05 abettadapur

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

SyMind avatar May 31 '24 09:05 SyMind

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

abettadapur avatar Jun 01 '24 19:06 abettadapur

@SyMind I'm having trouble creating a repro, but I can still reproduce the issue in my codebase

For more context, I think the issue only occurs in development mode, where RSPack seems to try to use the loader name as part of the chunk name.

For this particular cacheGroup, I am using a custom loader in my configuration, which is producing the above issue, even on v0.7.5

However, even in my repro repository, RSPack seems to use custom-loader in the chunk name, so I'm not sure what's different about my configurations

abettadapur avatar Jul 11 '24 18:07 abettadapur

My attempt at a repro here: https://github.com/abettadapur/rspack-chunk-repro

abettadapur avatar Jul 11 '24 18:07 abettadapur

And just to show you

image image

abettadapur avatar Jul 11 '24 18:07 abettadapur

@SyMind could you point me to where these cache group names are generated? I can try to debug on my end

abettadapur avatar Jul 11 '24 18:07 abettadapur

@abettadapur I will work on this issue this week.

SyMind avatar Aug 20 '24 02:08 SyMind

I ran both build and build-webpack in the following repository: abettadapur/rspack-chunk-repro. However, I couldn't identify any differences between Rspack and Webpack.

SyMind avatar Aug 29 '24 04:08 SyMind

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Oct 28 '24 04:10 stale[bot]