imagemin-webpack-plugin: externalImages.destination doesn't work when externalImages.sources are absolute paths
If you pass absolute paths to externalImages.sources, the destination seems to be completely ignored and the files are overwritten in place.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (16 by maintainers)
Good catch! It seems in my refactoring I managed to double-read the file!
I can fix that one along with this.
Another thing I noticed (and I don’t know if has anything to do with this plugin or not), but if I run webpack directly it takes about 4s to optimize a folder of images, BUT if it run the same exact webpack command through npm it takes over 40s for the same set of images. I’ve added some logging and it looks like the optimize itself is taking longer for some reason.
Also from looking at the code, I think you are reading the file contents twice if it isn’t in the cache – once on 151 and again on 159 https://github.com/Klathmon/imagemin-webpack-plugin/blob/683fbe4f5f23ece85127f73bbb98c2a6dbb36672/src/index.js#L151-L164