-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
feat: add cache.storeFilter for filtering cached assets #19577
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
base: main
Are you sure you want to change the base?
Conversation
@@ -1040,7 +1040,7 @@ export interface WebpackOptions { | |||
*/ | |||
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. |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
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?
WIP
Does this PR introduce a breaking change?
No
What needs to be documented once your changes are merged?
cache.type: 'memory'
not allowing additional configuration.