cacheFolder changed file
dmitryuk opened this issue · comments
Hello, I have enabled cache folder, but where is a trouble - if I changed image and ran build again, final image did't changed
I think it is because imagemin only check file exists
https://github.com/Klathmon/imagemin-webpack-plugin/blob/master/src/helpers.js#L98
What to do with that? Are you sure that exist check enough?
I think we should add additional birthtime or filesize checks of image
Ugh... This is why I wanted to avoid doing caching in this plugin in the first place...
In order to fix this I'd need to start either hashing the file contents before optimization and use that as the cache identifier, or store metadata about each file (creation time, filesize, etc...) before optimization in the cache directory.
Sadly I'm in the process of moving right now and probably won't have any time to really tackle this for the next few weeks.
If you or someone else wants to make a PR that fixes this I can easily merge it in quickly and make a beta release. A simple fix would be to have the hashFilename
be modified to become a hashFileContents
function, and just have the cachePath be the hash of the contents. It's not going to be the fastest, but it will solve the problem for now.
I have made the pull request
#59
What about quickly merge? )