performance.buildCache

  • Type:
type BuildCacheConfig =
  | {
      /**
       * Base directory for the filesystem cache.
       */
      cacheDirectory?: string;
      /**
       * Set different cache names based on cacheDigest content.
       */
      cacheDigest?: Array<string | undefined>;
      /**
       * An arrays of additional code dependencies for the build.
       * Rspack / webpack will use a hash of each of these items and all dependencies to invalidate the filesystem cache.
       */
      buildDependencies?: string[];
    }
  | boolean;

Controls the caching behavior during the build process.

Modern.js will enable build cache by default to improve the compile speed. You can disable the build cache by setting it to false:

export default {
  performance: {
    buildCache: false,
  },
};
WARNING

Starting from v2.69.0, Modern.js using rspack as build tool will enable buildCache by default; previous versions required manual configuration to enable it.

INFO

The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to Rsbuild - performance.buildCache.