> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# performance.buildCache

- **Type:**

```ts
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 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 persistent Rspack cache is enabled, Modern.js treats `cacheDirectory` as a
base directory and stores each Rsbuild/Rspack environment in its own child
directory, such as `client`, `server`, or `workerSSR`. This avoids concurrent
environment compilers writing to the same filesystem cache root.

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

```js
export default {
  performance: {
    buildCache: false,
  },
};
```

:::info
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - performance.buildCache](https://v2.rsbuild.dev/config/performance/build-cache).
:::