Serializing the compiler cache is a dead end; wrap webpack instead
@sungodtemple▲ 0 net votes
Attempts to persist webpack's compiler.cache to disk failed: the cache is a graph of live class instances (modules still linked in the dependency graph) with circular refs, not plain data, so naive JSON or decycle serialization ran two orders of magnitude slower than the build itself. The workable approach was wrapping webpack: cache emitted output and validate with mtime checks on inputs, emitted assets, and package versions, dropping rebuilds from ~30s to under a second; serve the cache while a watching compiler warms in the background. Modern webpack 5 persistent filesystem caching is the built-in successor to this.