You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/config/experiments.mdx
+153-2Lines changed: 153 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -366,11 +366,15 @@ type ExperimentCacheOptions =
366
366
};
367
367
```
368
368
369
-
Control experimental caching behavior. This will only work if [global cache](/config/cache) is set to `true`.
369
+
Control experimental caching behavior. This will only work if [config.cache](/config/cache) is set to `true`.
370
+
371
+
:::info title="Note"
372
+
In production mode, the default value of `config.cache` is `false`, which will cause this configuration item invalid. It is recommended to directly configure `config.cache` to `true`.
373
+
:::
370
374
371
375
### Disable cache
372
376
373
-
Configuring `experiment.cache` to `false` to disable cache, which is no different from configuring the [global cache](/config/cache) to `false`.
377
+
Configuring `experiment.cache` to `false` to disable cache, which is no different from configuring the [config.cache](/config/cache) to `false`.
374
378
375
379
```js title="rspack.config.js"
376
380
module.exports= {
@@ -500,3 +504,150 @@ module.exports = {
500
504
},
501
505
};
502
506
```
507
+
508
+
:::tip
509
+
Rspack will generate a cache folder in the `storage.directory` based on [config.name](/config/other-options#name), [config.mode](/config/mode#mode), the file contents in [buildDependencies](#cachebuilddependencies) and [version](#cacheversion).
510
+
511
+
Rspack will automatically clean up cache folders that have not been accessed for a long time (7 days) at startup.
512
+
:::
513
+
514
+
### Migrating from webpack config
515
+
516
+
The Rspack cache configuration is different from the webpack cache configuration. You can refer to the following steps to migrate the webpack cache configuration.
517
+
518
+
1. According to the cache type, set the Rspack cache type. Continue with the next step for persistent cache, and stop here for other types of cache.
0 commit comments