feat: add cache.storeFilter(entry) option#21237
Conversation
🦋 Changeset detectedLatest commit: 1321848 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ca98ce0 to
e629caf
Compare
|
This PR is packaged and the instant preview is available (1321848). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@1321848
yarn add -D webpack@https://pkg.pr.new/webpack@1321848
pnpm add -D webpack@https://pkg.pr.new/webpack@1321848 |
Merging this PR will improve performance by 46.73%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "side-effects-reexport", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
135.9 KB | 858.6 KB | -84.17% |
| ❌ | Memory | benchmark "many-modules-commonjs", scenario '{"name":"mode-production","mode":"production"}' |
7.5 MB | 9.8 MB | -23.38% |
| ⚡ | Memory | benchmark "lodash", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
859 KB | 129.4 KB | ×6.6 |
| ⚡ | Memory | benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
1,296.8 KB | 387.6 KB | ×3.3 |
| ⚡ | Memory | benchmark "wasm-modules-async", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
419.4 KB | 188.6 KB | ×2.2 |
| ⚡ | Memory | benchmark "wasm-modules-sync", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
252.7 KB | 151.7 KB | +66.62% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing feat/cache-store-filter (1321848) with main (b9323eb)
…ion cache entries from memory/filesystem cache
e629caf to
1321848
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21237 +/- ##
==========================================
- Coverage 92.80% 92.79% -0.01%
==========================================
Files 591 591
Lines 64560 64605 +45
Branches 17952 17967 +15
==========================================
+ Hits 59912 59949 +37
- Misses 4648 4656 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
What kind of change does this PR introduce?
Adds a
cache.storeFilteroption that lets users exclude cache entries from the memory/filesystem cache, addressing oversized caches caused by asset module binaries being stored (and duplicated). Fixes #19359 and #19577.The filter is called only for the known Compilation caches (
modules,assets,codeGeneration) with a discriminated{ type, data }entry — sotypenarrowsdatatoModule/Source/CodeGenerationResult— and returningfalseskips storing that entry. Plugin caches are always stored. The cache-type lookup strips the child-compilercompilerPathprefix soentry.typematchesCACHE_TYPESregardless of compiler nesting.Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Yes,
cache.storeFilteroption.Use of AI
Yes