[Feature Request] Allow cacheKey customization #303
Description
Hello all,
Would it be possible to add an option to allow us to customize the cacheKey when caching?
Currently, this is the predefined cacheKey that is used.
if (this.options.cache) {
task.cacheKey = serialize({
'uglify-es': versions.uglify,
'uglifyjs-webpack-plugin': versions.plugin,
'uglifyjs-webpack-plugin-options': this.options,
path: compiler.outputPath ? `${compiler.outputPath}/${file}` : file,
hash: crypto.createHash('md4').update(input).digest('hex'),
});
}
My use case is that on my production build machine, I will clone my repo into a temporary folder. The name of the temp folder is the git hash. My goal is to have the uglify cache reside outside this temp folder (which is doable as the cache option takes a string which is the cache directory).
My issue is that the cache doesn't help in this case as the cacheKey takes compiler.outputPath
into consideration (the output path contains my temp folder name). Therefore, nothing will hit in the cache.
An option to allow me to customize the cacheKey that is used would let me define it so that compiler.outputPath
is not used in the cacheKey.