false>= 1.2.5To enable or configure persistent build cache.
When enabled, Rspack will store the build snapshots in the cache directory. In subsequent builds, if the cache is hit, Rspack can reuse the cached results instead of rebuilding from scratch, which can reduce the build time.
Rspack's persistent cache is experimental and may change in the future.
Setting performance.buildCache to true will enable the persistent build cache:
Or only enable cache in development mode:
stringnode_modules/.cacheSet the output directory of the cache files.
Array<string | undefined>undefinedAdd additional cache digests, the previous build cache will be invalidated when any value in the array changes.
cacheDigest can be used to add some variables that will affect the build result, for example process.env.SOME_ENV.
string[]undefinedbuildDependencies is 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.
Rsbuild will use the following configuration files as the default build dependencies:
package.jsontsconfig.jsonrsbuild.config.*.browserslistrctailwindcss.config.*When using Rsbuild CLI, it will also automatically add .env and .env.* files to the build dependencies.
When you add other build dependencies, Rsbuild merges these custom dependencies with the default dependencies and passes them to Rspack.