farm
farm copied to clipboard
Optimize persistent cache strategy
What problem does this feature solve?
Currently when lockfile is changed, all cache will be invalidated. For some dependencies like components, they could be changed frequently, so Farm need to support configuring that if some packages are changed, only caches of these packages are invalidated, caches of other packages should be reused.
What does the proposed API look like?
- add a
loose: boolean
, when keys like lockfile changed withloose: true
, all cache should not be invalidated, and Farm should validate cache for immutable modules. - optimize optimize_module_graph and render_resource_pot_modules cache. optimize_module_graph should be cached to skip unnecessary calculations. and cache of render_resource_pot_modules should considering used exports info of the modules.
- Config can be modified in rust plugins, farm should use final config to generate cache key for global keys.
- Optimize cache storage algorithm, there are thousands of modules generated under
node_modules/.farm/cache
, we needs to limit the storage usege
有进展吗?我非常关心该功能
正在实现中,会优先支持
可设置 persistentCache: { globalBuiltinCacheKeyStrategy: { lockfile: false } } }
关闭 lockfile 的检查