Persistent caching, and a warm build that is seconds

Every build in 4 started from nothing, which on a large application is a minute of parsing and transpiling that produces the same result as last time.

module.exports = {
  cache: {
    type: 'filesystem',
    buildDependencies: {
      config: [__filename],      // invalidate when THIS file changes
    },
  },
};

// cold: 84s. warm: 6s.

buildDependencies is what stops a stale cache surviving a config change, and omitting it produces a build that ignores the change you just made — which is a genuinely confusing twenty minutes. The cache lives in node_modules/.cache by default, so a CI runner needs it explicitly cached to see any benefit. This is the single strongest reason to upgrade and it is worth leading with when arguing for the work.