website/docs/en/config/incremental.mdx
incremental controls Rspack's incremental build capability. When enabled, Rspack reuses unaffected intermediate results during rebuilds and Hot Module Replacement (HMR), and only recalculates the stages and assets affected by the change.
boolean | 'none' | 'safe' | 'advance' | 'advance-silent' | Incremental'advance-silent':::tip
When cache is disabled, Rspack disables the incremental build stages. Keep cache enabled if you want to use incremental builds during development, watch, or HMR.
:::
incremental can be configured with presets or a detailed object.
Most projects can use the default value; configure this option explicitly only when you need to disable incremental builds, fall back to a more conservative strategy, or diagnose incremental build issues.
| Value | Behavior |
|---|---|
false / 'none' | Disable incremental builds for all stages. |
'safe' | Enable incremental builds only for the buildModuleGraph, buildChunkGraph, and emitAssets stages. |
true / 'advance-silent' | Enable all incremental stages and silently handle cases that are not friendly to incremental builds. This is the default behavior of Rspack. |
'advance' | Enable the same stages as 'advance-silent', but emit warnings when configuration or plugin behavior causes Rspack to disable incremental passes. This helps identify what is limiting incremental build performance. |
By default, you do not need to configure incremental explicitly. To surface warnings when configuration or plugin behavior disables incremental passes during development, use 'advance':
export default {
incremental: 'advance',
};
You can also configure incremental with an object to control each build stage individually. Object configuration is mainly intended for debugging or temporary workarounds; presets are recommended for normal usage.
export default {
incremental: {
silent: false,
modulesCodegen: false,
},
};
type Incremental = {
// Whether to suppress warnings for cases that are not friendly to incremental builds.
// Set this to false to emit warnings.
silent?: boolean;
// The following options control whether incremental builds are enabled for each stage.
buildModuleGraph?: boolean;
finishModules?: boolean;
optimizeDependencies?: boolean;
buildChunkGraph?: boolean;
optimizeChunkModules?: boolean;
moduleIds?: boolean;
chunkIds?: boolean;
modulesHashes?: boolean;
modulesCodegen?: boolean;
modulesRuntimeRequirements?: boolean;
chunksRuntimeRequirements?: boolean;
chunksHashes?: boolean;
chunkAsset?: boolean;
emitAssets?: boolean;
};
Incremental builds mainly improve rebuilds and HMR when reusable compilation state already exists. They do not make an initial build faster when no state can be reused.
When persistent cache is enabled and hit, Rspack can restore part of the compilation state from cache, so the build after startup can also benefit from incremental builds.
The table below shows the results of incremental in different scenarios:
| how to build | incremental speed up |
|---|---|
| hot build | ✅ |
| cold build | ❌ |
| hot start | ✅ |
| cold start | ❌ |
| rebuild/HMR | ✅ |
In the table, "hot" means reusable compilation state or persistent cache is available, while "cold" means no reusable state is available.