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]: cacheGroups filename params with maxSize doesn't take effect #6440

Open
abettadapur opened this issue May 5, 2024 · 10 comments
Open
Assignees
Labels
bug Something isn't working stale

Comments

@abettadapur
Copy link

abettadapur commented May 5, 2024

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 abettadapur added bug Something isn't working pending triage The issue/PR is currently untouched. labels May 5, 2024
@abettadapur
Copy link
Author

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 abettadapur changed the title [Bug]: [contentHash] with maxSize doesn't take effect [Bug]: cacheGroups filename params with maxSize doesn't take effect May 5, 2024
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label May 6, 2024
@SyMind
Copy link
Member

SyMind commented May 31, 2024

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

@abettadapur
Copy link
Author

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

@abettadapur
Copy link
Author

@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
Copy link
Author

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

@abettadapur
Copy link
Author

And just to show you

image
image

@abettadapur
Copy link
Author

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

@SyMind
Copy link
Member

SyMind commented Aug 20, 2024

@abettadapur I will work on this issue this week.

@SyMind
Copy link
Member

SyMind commented Aug 29, 2024

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.

Copy link

stale bot commented Oct 28, 2024

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 stale bot added the stale label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants