Skip to content

Commit d301eb1

Browse files
Limit webpack cache version to output-affecting dimensions
Remove THREAD, WORKERS, and CACHE_COMP from Webpack filesystem cache version to avoid unnecessary invalidations across machines/CI runners. This keeps BUILD_CACHE_COMPRESSION effective via the compression field without affecting cache validity. Why: Worker count, thread toggle, and cache compression do not change module outputs; including them in the version reduces cross-run cache hit rates. Retain PROD in the version since prod/dev impacts outputs.
1 parent b48a0af commit d301eb1

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

build.mjs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,9 @@ async function runWebpack(isWithoutKatex, isWithoutTiktoken, minimal, sourceBuil
138138
cache: {
139139
type: 'filesystem',
140140
name: `webpack-${variantId}`,
141-
version: JSON.stringify({
142-
THREAD: enableThread,
143-
WORKERS: threadWorkers,
144-
CACHE_COMP: cacheCompressionOption ?? false,
145-
PROD: isProduction,
146-
}),
141+
// Only include dimensions that affect module outputs to avoid
142+
// unnecessary cache invalidations across machines/CI runners
143+
version: JSON.stringify({ PROD: isProduction }),
147144
// default none; override via BUILD_CACHE_COMPRESSION=gzip|brotli
148145
compression: cacheCompressionOption ?? false,
149146
buildDependencies: {

0 commit comments

Comments
 (0)