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.

    When you are using webpack as build tool, 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,
      },
    };

    It should be noted that, Rspack's persistent cache is experimental, which may change in future versions, and this feature needs to be turned on manually.

    INFO

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