GeezerVison is showing github.com — fix: forward the compile cache only when the CLI enabled it by alexander-akait · Pull Request #22722 · webpack/webpack
Conversation
alexander-akait
commented
Oct 16, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Follow-up to #22706. When a preload (for example NODE_OPTIONS=--require …) has already enabled the compile cache, enableCompileCache() returns ALREADY_ENABLED with the version-tagged directory. bin/webpack.js then forwarded that as NODE_COMPILE_CACHE, and children tagged it a second time, so they missed the parent's cache. It now forwards only on ENABLED. CodeRabbit found the same bug in webpack/webpack-cli#4872.
first call: {"status":1,"directory":"/tmp/node-compile-cache"}
second call: {"status":2,"directory":"/tmp/node-compile-cache/v22.22.0-x64-ac9e9e6b-0"}
| With a preload |
NODE_COMPILE_CACHE the CLI sets |
| Before |
/tmp/node-compile-cache/v22.22.0-x64-9de703df-0 (children nest a second tag) |
| After |
not set (children enable the cache through the preload, in the same directory) |
The changeset from #22706 is still unreleased and covers this fix, so this PR adds none.
What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes: a preload case in test/unitCases/BinCompileCache.unittest.js. It fails without the fix.
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?
n/a
Use of AI
Written with Claude Code: it reproduced the ALREADY_ENABLED directory, wrote the fix and the test, and ran lint. Directed and reviewed by the author.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QYPkbvwyRWt2SHgXDoYRdo
Generated by Claude Code
Summary by CodeRabbit
- Bug Fixes
- Compile-cache configuration now respects the cache’s enabled status before setting its directory for the process. This prevents an inactive cache directory from being applied when the cache is not enabled.
- Corrected handling when a preload enables the cache, so child processes do not receive a redundant cache-directory setting. The reported child cache directory now contains a single version tag.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A cache a preload already enabled reports its version-tagged directory,
which a child would tag again.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is packaged and the instant preview is available (4d15e69).
Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@4d15e69
yarn add -D webpack@https://pkg.pr.new/webpack@4d15e69
pnpm add -D webpack@https://pkg.pr.new/webpack@4d15e69
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Types CoverageCoverage after merging fix/compile-cache-already-enabled into main will be
Coverage Report| File | Stmts | Branches | Funcs | Lines | Uncovered Lines |
|---|
| bin | | webpack.js | 98.86% | 100% | 100% | 98.86% | 113 | | declarations | | WebpackOptions.ts | 99.94% | 100% | 100% | 99.94% | 4238 | | examples | | build-common.js | 100% | 100% | 100% | 100% | | | buildAll.js | 100% | 100% | 100% | 100% | | | examples.js | 100% | 100% | 100% | 100% | | | template-common.js | 98.21% | 100% | 100% | 98.21% | 72 | | examples/custom-javascript-parser | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/custom-javascript-parser/internals | | acorn-parse.js | 100% | 100% | 100% | 100% | | | meriyah-parse.js | 100% | 100% | 100% | 100% | | | oxc-parse.js | 100% | 100% | 100% | 100% | | | examples/markdown | | webpack.config.mjs | 100% | 100% | 100% | 100% | | | examples/module-federation | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/reexport-components | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/ssr | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/typescript | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/typescript-non-erasable | | test.filter.js | 50% | 100% | 100% | 50% | 5 | | examples/virtual-modules | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-bindgen-esm | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-complex | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-emscripten | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-simple | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-simple-source-phase | | test.filter.js | 100% | 100% | 100% | 100% | | | lib | | Chunk.js | 100% | 100% | 100% | 100% | | | Compilation.js | 98.67% | 100% | 100% | 98.67% | 1766, 2079, 2086, 2094, 2116, 2119, 23, 3097, 3634, 3672, 4261, 4265, 4392, 4413, 4538, 4575, 4582, 4635–4636, 4640, 4645, 4661–4662, 4676–4677, 4682–4683, 5207, 5233, 6063, 6080, 6098, 6114, 6129, 6154, 6157, 6525, 6528–6529, 6534, 6549, 6632, 6656, 842–843 | | Compiler.js | 98.81% | 100% | 100% | 98.81% | 1116, 1153, 1156, 1336–1337, 1345, 848, 934, 975 | | Dependency.js | 100% | 100% | 100% | 100% | | | DependencyTemplate.js | 100% | 100% | 100% | 100% | | | EntryPlugin.js | 100% | 100% | 100% | 100% | | | Entrypoint.js | 100% | 100% | 100% | 100% | | | ExternalsPlugin.js | 100% | 100% | 100% | 100% | | | FileSystemInfo.js | 100% | 100% | 100% | 100% | | | InitFragment.js | 100% | 100% | 100% | 100% | | | LibraryTemplatePlugin.js | 100% | 100% | 100% | 100% | | | ModuleFilenameHelpers.js | 100% | 100% | 100% | 100% | | | ModuleNotFoundError.js | 100% | 100% | 100% | 100% | | | MultiCompiler.js | 98.91% | 100% | 100% | 98.91% | 489, 561, 748, 813 | | NormalModule.js | 100% | 100% | 100% | 100% | | | NullFactory.js | 100% | 100% | 100% | 100% | | | ProgressPlugin.js | 100% | 100% | 100% | 100% | | | RawModule.js | 100% | 100% | 100% | 100% | | | RequestShortener.js | 100% | 100% | 100% | 100% | | | SingleEntryPlugin.js | 100% | 100% | 100% | 100% | | | WebpackError.js | 100% | 100% | 100% | 100% | | | index.js | 100% | 100% | 100% | 100% | | | webpack.js | 98.59% | 100% | 100% | 98.59% | 306, 308 | | lib/asset | | AssetBytesGenerator.js | 100% | 100% | 100% | 100% | | | AssetBytesParser.js | 100% | 100% | 100% | 100% | | | AssetGenerator.js | 100% | 100% | 100% | 100% | | | AssetModule.js | 100% | 100% | 100% | 100% | | | AssetModulesPlugin.js | 98.45% | 100% | 100% | 98.45% | 335, 359, 362, 492, 59 | | AssetParser.js | 100% | 100% | 100% | 100% | | | AssetSourceGenerator.js | 100% | 100% | 100% | 100% | | | AssetSourceParser.js | 100% | 100% | 100% | 100% | | | RawDataUrlModule.js | 100% | 100% | 100% | 100% | | | WebManifestGenerator.js | 100% | 100% | 100% | 100% | | | WebManifestParser.js | 100% | 100% | 100% | 100% | | | lib/async-modules | | AsyncModuleHelpers.js | 100% | 100% | 100% | 100% | | | AwaitDependenciesInitFragment.js | 100% | 100% | 100% | 100% | | | InferAsyncModulesPlugin.js | 100% | 100% | 100% | 100% | | | isGeneratorLowered.js | 100% | 100% | 100% | 100% | | | lib/bun | | BunTargetPlugin.js | 100% | 100% | 100% | 100% | | | lib/cache | | AddBuildDependenciesPlugin.js | 100% | 100% | 100% | 100% | | | AddManagedPathsPlugin.js | 100% | 100% | 100% | 100% | | | Cache.js | 96.49% | 100% | 100% | 96.49% | 10, 104 | | CacheFacade.js | 100% | 100% | 100% | 100% | | | IdleFileCachePlugin.js | 97.92% | 100% | 100% | 97.92% | 75, 87, 95 | | MemoryCachePlugin.js | 92% | 100% | 100% | 92% | 33, 42 | | MemoryWithGcCachePlugin.js | 93.42% | 100% | 100% | 93.42% | 106, 120–121, 130, 88 | | PackFileCacheStrategy.js | 96.54% | 100% | 100% | 96.54% | 1304, 1404, 1408, 1470, 1716, 1800, 1823, 1853, 682, 701, 711–713, 715, 731–732, 737, 740, 742, 747, 752, 777, 783, 817, 823, 829, 834, 845, 854, 859–860, 862, 879, 885–886, 888 | | ResolverCachePlugin.js | 100% | 100% | 100% | 100% | | | getLazyHashedEtag.js | 100% | 100% | 100% | 100% | | | mergeEtags.js | 100% | 100% | 100% | 100% | | | lib/config | | OptionsApply.js | 100% | 100% | 100% | 100% | | | PlatformPlugin.js | 100% | 100% | 100% | 100% | | | WebpackOptionsApply.js | 100% | 100% | 100% | 100% | | | WebpackOptionsDefaulter.js | 100% | 100% | 100% | 100% | | | browserslistTargetHandler.js | 100% | 100% | 100% | 100% | | | cli.js | 98.88% | 100% | 100% | 98.88% | 114, 546, 578, 628 | | defaults.js | 99.38% | 100% | 100% | 99.38% | 1629–1631, 1639, 283, 286, 291, 295, 544 | | defineConfig.js | 100% | 100% | 100% | 100% | | | getClaimedAssetTypes.js | 100% | 100% | 100% | 100% | | | normalization.js | 99.14% | 100% | 100% | 99.14% | 285–286, 356, 371 | | target.js | 100% | 100% | 100% | 100% | | | validateSchema.js | 94.67% | 100% | 100% | 94.67% | 100, 87, 89, 98 | | lib/container | | ContainerEntryDependency.js | 100% | 100% | 100% | 100% | | | ContainerEntryModule.js | 100% | 100% | 100% | 100% | | | ContainerEntryModuleFactory.js | 100% | 100% | 100% | 100% | | | ContainerExposedDependency.js | 100% | 100% | 100% | 100% | | | ContainerPlugin.js | 100% | 100% | 100% | 100% | | | ContainerReferencePlugin.js | 100% | 100% | 100% | 100% | | | FallbackDependency.js | 100% | 100% | 100% | 100% | | | FallbackItemDependency.js | 100% | 100% | 100% | 100% | | | FallbackModule.js | 100% | 100% | 100% | 100% | | | FallbackModuleFactory.js | 100% | 100% | 100% | 100% | | | HoistContainerReferencesPlugin.js | 100% | 100% | 100% | 100% | | | ModuleFederationPlugin.js | 100% | 100% | 100% | 100% | | | RemoteModule.js | 100% | 100% | 100% | 100% | | | RemoteRuntimeModule.js | 100% | 100% | 100% | 100% | | | RemoteToExternalDependency.js | 100% | 100% | 100% | 100% | | | declaredRemotes.js | 100% | 100% | 100% | 100% | | | moduleFederationHooks.js | 100% | 100% | 100% | 100% | | | options.js | 100% | 100% | 100% | 100% | | | lib/context | | ContextExclusionPlugin.js | 100% | 100% | 100% | 100% | | | ContextModule.js | 99.88% | 100% | 100% | 99.88% | 1495 | | ContextModuleFactory.js | 95.70% | 100% | 100% | 95.70% | 230, 257, 276, 280–281, 289, 466, 487, 492, 534, 543, 545, 549, 552, 558–559 | | ContextReplacementPlugin.js | 100% | 100% | 100% | 100% | | | lib/css | | CssGenerator.js | 99.29% | 100% | 100% | 99.29% | 1092, 134, 301, 849 | | CssInjectStyleRuntimeModule.js | 100% | 100% | 100% | 100% | | | CssLoadingRuntimeModule.js | 100% | 100% | 100% | 100% | | | CssModule.js | 100% | 100% | 100% | 100% | | | CssModulesPlugin.js | 98.72% | 100% | 100% | 98.72% | 217, 418, 432, 445, 458, 481, 494, 507, 520 | | CssParser.js | 99.76% | 100% | 100% | 99.76% | 1094, 2431, 3078, 3081, 3087, 3520, 947 | | CssServerStylesRuntimeModule.js | 100% | 100% | 100% | 100% | | | conventions.js | 98.65% | 100% | 100% | 98.65% | 93 | | cssMinify.js | 100% | 100% | 100% | 100% | | | data.js | 99.84% | 100% | 100% | 99.84% | 229, 5601 | | syntax-parser.js | 99.69% | 100% | 100% | 99.69% | 10776–10777, 11315–11316, 11353, 11563, 11612, 13930, 13991–13994, 14099–14100, 14198–14199, 14918, 15215, 15217, 15737, 16103, 18246, 2616, 3321, 3323, 3328, 3347, 4096, 4102 | | syntax-printer.js | 99.33% | 100% | 100% | 99.33% | 2603–2604, 2606–2607, 2609–2610, 2615, 2885–2888, 2981, 353, 3666, 4091, 4227, 4927, 5238, 6026, 727 | | syntax.js | 100% | 100% | 100% | 100% | | | topologicalSort.js | 100% | 100% | 100% | 100% | | | lib/debug | | ProfilingPlugin.js | 94.02% | 100% | 100% | 94.02% | 169, 417–419, 421, 425, 433, 437, 452, 580, 587, 596, 600, 609, 614, 620, 625, 92 | | lib/define | | DefinePlugin.js | 98.85% | 100% | 100% | 98.85% | 1493, 268–269, 285, 304, 378, 936, 938, 943, 967 | | DotenvPlugin.js | 97.58% | 100% | 100% | 97.58% | 276, 391, 439, 452–453 | | EnvironmentPlugin.js | 97.14% | 100% | 100% | 97.14% | 49 | | lib/deno | | DenoTargetPlugin.js | 100% | 100% | 100% | 100% | | | lib/dependencies | | ConstDependency.js | 100% | 100% | 100% | 100% | | | ContextElementDependency.js | 100% | 100% | 100% | 100% | | | NullDependency.js | 100% | 100% | 100% | 100% | | | lib/dependencies/amd | | AMDDefineDependency.js | 100% | 100% | 100% | 100% | | | AMDDefineDependencyParserPlugin.js | 100% | 100% | 100% | 100% | | | AMDPlugin.js | 99.31% | 100% | 100% | 99.31% | 54 | | AMDRequireArrayDependency.js | 100% | 100% | 100% | 100% | | | AMDRequireContextDependency.js | 100% | 100% | 100% | 100% | | | AMDRequireDependenciesBlock.js | 100% | 100% | 100% | 100% | | | AMDRequireDependenciesBlockParserPlugin.js | 100% | 100% | 100% | 100% | | | AMDRequireDependency.js | 100% | 100% | 100% | 100% | | | |
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 16, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: webpack/webpack/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b92fee7f-52ba-48fc-aa11-d04d2d69c466
📥 Commits
-
Reviewing files that changed from the base of the PR and between ed7012d and 895279e.
📒 Files selected for processing: 2
-
bin/webpack.js
test/unitCases/BinCompileCache.unittest.js
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
📝 Walkthrough
-
The bin command now checks compile-cache status before setting NODE_COMPILE_CACHE. A unit test covers a preload that enables the cache and checks the reported cache directory.
Changes: Compile Cache Environment Handling
| Layer / File(s) |
Summary |
Check cache status and verify preload behavior bin/webpack.js, test/unitCases/BinCompileCache.unittest.js |
The bin command sets NODE_COMPILE_CACHE only when compile-cache status is ENABLED and the variable is unset. A test covers a preload that enables the cache. |
Suggested reviewers: xiaoxiaojx
Priority: ⬇️ Low
Change: Bug fix
Merge Risk: ⚪ Minimal · up to 89527
-
This change stops the CLI from forwarding an already version-tagged compile-cache directory to child processes, so children reuse the preload's cache. No actionable merge-blocking risk was identified.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title uses the allowed Conventional Commit type fix, has an optional scope omitted, and accurately describes the compile-cache forwarding change. The branch prefix is not provided, so that speci… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Generated code size
Comparing base (ed7012d) to head (895279e). Merging this pull request will not change the code webpack generates.
| What moved |
Tests |
Assets |
Gzip |
Raw |
Test edit |
| Changed, test untouched |
0 |
0 |
— |
— |
— |
| Changed, test edited |
0 |
0 |
— |
— |
— |
| New |
0 |
0 |
— |
— |
— |
| Deleted |
0 |
0 |
— |
— |
— |
| Unchanged |
— |
8843 |
— |
— |
— |
Read Changed, test untouched first: the test is byte-identical on both sides, so webpack generated the difference. Changed, test edited moved partly because the test did — Test edit is how many bytes the test gained, and a bundle that grew by less is not a regression. New and Deleted are whole files, not deltas — a new asset was created, not grown, so it reads gray (⚪ added) — and adding tests cannot bury a real change. Gzip decides, because that is what users download; raw is the tiebreak, and brotli and zstd are per asset below.
No asset changed size.
No runtime gained or lost a runtime module.
Built test/configCases with the defaults a user gets: 2243 test(s), 8843 asset(s), 100 emitted nothing.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging this PR will degrade performance by 46.47%
⚠️ 108 benchmarks spent significant time in system calls
System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.
Measurement and system calls
benchmark "cache-filesystem-cold", scenario '{"name":"mode-development","mode":"development"}'
benchmark "cache-filesystem", scenario '{"name":"mode-production","mode":"production"}'
benchmark "concatenate-modules", scenario '{"name":"mode-development","mode":"development"}'
benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
benchmark "cache-filesystem-cold", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
benchmark "asset-modules-bytes", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
benchmark "wasm-modules-sync", scenario '{"name":"mode-production","mode":"production"}'
benchmark "no-minimize", scenario '{"name":"mode-development","mode":"development"}'
benchmark "devtool-eval", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
benchmark "import-meta-glob", scenario '{"name":"mode-development","mode":"development"}'
- …and 98 more
ℹ️ 29 benchmarks have no flame graph
The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.
benchmark "wasm-modules-sync", scenario '{"name":"mode-production","mode":"production"}'
benchmark "common-libs", scenario '{"name":"mode-production","mode":"production"}'
benchmark "asset-modules-inline", scenario '{"name":"mode-production","mode":"production"}'
benchmark "asset-modules-resource", scenario '{"name":"mode-production","mode":"production"}'
benchmark "context-commonjs", scenario '{"name":"mode-production","mode":"production"}'
benchmark "context-esm", scenario '{"name":"mode-production","mode":"production"}'
benchmark "hmr", scenario '{"name":"mode-production","mode":"production"}'
benchmark "devtool-eval-source-map", scenario '{"name":"mode-production","mode":"production"}'
benchmark "devtool-eval", scenario '{"name":"mode-production","mode":"production"}'
benchmark "three-long", scenario '{"name":"mode-production","mode":"production"}'
- …and 19 more
⚠️ Different runtime environments detected
Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.
Open the report in CodSpeed to investigate
⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 403 untouched benchmarks
⏩ 6 skipped benchmarks1
Performance Changes
Tip Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/compile-cache-already-enabled (895279e) with main (ed7012d)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.45%. Comparing base (ed7012d) to head (895279e).
Additional details and impacted files
@@ Coverage Diff @@
## main #22722 +/- ##
==========================================
- Coverage 96.45% 96.45% -0.01%
==========================================
Files 776 776
Lines 135518 135518
Branches 45644 45644
==========================================
- Hits 130709 130708 -1
- Misses 4809 4810 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|