Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Caches the result of following loaders on disk

License

Notifications You must be signed in to change notification settings

fxxjdedd/cache-loader-hash

 
 

Repository files navigation

cache-loader-hash

Added the mode option to the cache-loader options, supporting mtime (default) and hash.

Usage

npm install cache-loader-hash --save-dev
webpackChain.module
  .rule('js') // or ts, tsx, vue...
  .use('cache-loader')
  .loader(require.resolve('cache-loader-hash'))
  .tap((options) => {
    options.mode = 'hash';
    return options;
  });

No Breaking Change

No breaking change when using mtime mode.

Why

We are doing a CI package acceleration work, which will store node_modules/.cache on s3, and then pull it from s3 at a certain time. due to The cache-loader uses mtime by default for cache verification, which causes the newly installed node_modules in the new CI process to not match the mtime of node_modules/.cache on s3. The solution to this problem is to use the hash of the file instead of mtime as the cache verification method of the cache-loader.

License

MIT

About

Caches the result of following loaders on disk

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%