webpack-contrib/image-minimizer-webpack-plugin

Images bug in dev server

dx1ded opened this issue · 5 comments

Hello! I tried to use this plugin in dev server but there's something strange. I have generators (for .webp and .avif) and i try to require it in HTML (in my case it is .pug but never mind). When i have one require it is ok, but when i have two requires or more - the last require generates image, each previous returns default value (in my case it is .jpg).

Video demonstation:

click

Webpack configuration:

click

Bug in html-webpack-plugin, sorry I can't fix it here

I'm sorry, what did you mean? This bug connected with html-webpack-plugin only?

Yes, bug happens only with html-webpack-plugin, please report them

Ok, thanks!)

Anyway I recommend do not use loader directory - https://github.com/dx1ded/webpack-mpa/blob/main/webpack.config.js#L124, just setup plugin, by default plugin enable loader under the hood, just set test for plugin (and the same value will be applied for loader), also if you need generate images for copy plugin you need some more options https://github.com/webpack-contrib/image-minimizer-webpack-plugin#generate-webp-images-from-copied-assets. Loader interfaced required only for complex setup, I think it is not your case