Skip to content

Conversation

@cseas
Copy link

@cseas cseas commented Jun 3, 2025

Fixes #19359

What kind of change does this PR introduce?

Add a new config option cache.storeFiles which gives the users an option to configure filtering for which assets should be excluded from cache.

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

What needs to be documented once your changes are merged?

export interface MemoryCacheOptions {
/**
* Additionally cache computation of modules that are unchanged and reference only unchanged modules.
* Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change this line. This was added automatically by yarn run fix:special

/**
* A function to filter which cache entries should be stored. Return false to skip storing a cache entry.
*/
storeFilter?: (identifier: string, data: any) => boolean;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function signature is similar to the one suggested by @alexander-akait here but I'm not sure if there are any use-cases for filtering on data.

Need input from the maintainers here. If it isn't required, I'll go ahead and remove the data parameter.

@cseas cseas marked this pull request as ready for review June 3, 2025 08:17
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work for memory cache too, also please add test cases

@cseas cseas marked this pull request as draft June 3, 2025 17:00
@cseas cseas marked this pull request as ready for review June 9, 2025 11:28
@cseas cseas requested a review from alexander-akait June 9, 2025 11:28
@cseas
Copy link
Author

cseas commented Jun 9, 2025

It should work for memory cache too, also please add test cases

@alexander-akait I've added the storeFilter property to MemoryCachePlugin as well. Also added unit tests for both IdleFileCachePlugin and MemoryCachePlugin. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Asset module binary files are stored in webpack cache

2 participants