Added the mode option to the cache-loader
options, supporting mtime
(default) and hash
.
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 when using mtime
mode.
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.
MIT