Caches the result of following webpack loaders on disk (or database) to speed up subsequent builds. The current stable version is 4.1.0, actively maintained by the webpack-contrib team. Key differentiator: it caches at the loader level rather than at the module level like hard-source-webpack-plugin, making it ideal for expensive transpilation or compilation loaders. Note that there is overhead for reading/writing cache files, so only use for expensive loaders. Supports configurable cache directory, cache key, cache identifier, read/write functions, and read-only mode.
npm install cache-loaderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This shows how to use cache-loader to cache the result of babel-loader on disk.
Only use cache-loader for expensive loaders like babel-loader, ts-loader, or sass-loader.
Upgrade Node.js to >=8.9.0 and webpack to ^4.0.0.
Use 'cacheKey' option to customize cache key generation.
Set readOnly: true in loader options to avoid writes.
npm install --save-dev cache-loader
npm install --save-dev webpack@^4.0.0
Ensure cache-loader is the first loader in the 'use' array.