image-minimizer-webpack-plugin: Support for processing images using CopyWebpackPlugin doesn't work in v3
Hi – I’m trying to upgrade to v3, but I can’t seem to get the new version to work in concert with the CopyWebpackPlugin
.
Basically I’m moving a bunch of png
s into a specific folder and then am converting them to webp
.
Here is my current webpack config if that helps any: https://github.dev/gitkraken/vscode-gitlens/blob/15e4f478c3e84c78552c7531dbbbaa926c91ed35/webpack.config.js#L379-L398
Here is a discussion about the prior support: https://github.com/webpack/webpack/discussions/14280#discussioncomment-1851786
Thanks!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 33 (22 by maintainers)
Woo! Works – thanks so much!
I will look at this in near future
Odd, happened every time with the
yarn run watch
build.Please try https://github.com/webpack-contrib/image-minimizer-webpack-plugin/releases/tag/v3.2.1, tomorrow I will do deep investigation about perf
Ah gotcha – thanks for the clarification. And thanks so much for the investigation and fix! Even if the perf is worse, I’ll be happy to switch over to squoosh over imagemin as the later is now unmaintained.
Thanks again!
@eamodio Fixed https://github.com/webpack-contrib/image-minimizer-webpack-plugin/pull/293, works with with your examples, unfortunately it is slow than imagemin (and the problem in
squoosh
, that is strange, becausesquoosh
create worker only once,imagemin
do it on each call), my first idea - the problem in double buffer converting, investigating it tooFound leaking… wip on fix
@alexander-akait Thank you!
So I tried it out both integrated with my GitLens build and also as a completely separate webpack config (for debugging). and even with the latest I still see the memory errors when integrated into the GitLens build, but not when it’s part of its own config.
While not a simple sample, if you clone https://github.com/gitkraken/vscode-gitlens, and
yarn install
you can try the multiple versions.These configs cause issue when using squoosh (here is the config):
yarn run build
— will build everything usingImageMinimizerPlugin
as a plugin using image-minyarn run build --env squoosh
— same as above but will use squoosh and fail with wasm out of memory errorsyarn run bundle
— will build everything usingImageMinimizerPlugin
as an optimizer using image-minyarn run bundle --env squoosh
— same as above but will use squoosh and fail with wasm out of memory errorsThese configs work fine with squoosh (here is the config):
yarn run copy:images
— will useImageMinimizerPlugin
as a plugin using image-minyarn run copy:images --env squoosh
— same as above but will use squooshyarn run copy:images --mode production
— will useImageMinimizerPlugin
as an optimizer using image-minyarn run copy:images --mode production --env squoosh
— same as above but will use squoosh@alexander-akait Thanks will check that out!
[EDIT] I’ve switched over now thanks! 😄