Cache

Rspack will cache snapshots and intermediate products during the build process and use them in the next build to improve the speed of the build. Rspack will perform caching operations in the following process:

  • resolve module

At this stage, Rspack will cache the results of module resolve requests and generate snapshots. When rebuilding, it will directly reuse valid snapshots to obtain results. For more snapshot configurations, refer to snapshot.resolve.

  • build module

At this stage, Rspack will cache the results of module build and generate snapshots. When rebuilding, it will directly reuse valid snapshots to obtain results. For more snapshot configurations, refer to snapshot.module.

  • module code generation

At this stage, Rspack will cache the final code generated by the module, and if the module has not changed, it will directly reuse the generated code when rebuilding.

Cache Type

Rspack currently only supports memory cache, persistent cache is under planning, for more details refer to persistent-cache-support.

This configuration currently only supports setting whether to enable caching.

Usage

You can disable the cache directly in rspack.config.js:

rspack.config.js
module.exports = {
  cache: false,
};
ON THIS PAGE