Images hash name diffrent with images in production html when use ImageMinimizerPlugin
taosapp opened this issue ยท 3 comments
Current behaviour ๐ฃ
Asset Modules and ImageMinimizerWebpackPlugin,
assetModuleFilename: 'img/[name].[hash:8][ext][query]'
npm run build
the images name diffrent with HTML image name, such as logo.7c70fb17.png in img folder but img/logo.6d5cc11e.png in HTML
Expected behaviour โ๏ธ
images name same as images src value in HTML after build
Reproduction Example ๐พ
Environment ๐ฅ
Node.js v16.7.0
win32 10.0.19043
npm 7.21.0
webpack 5.51.1
webpack-cli 4.8.0
webpack-dev-server 4.0.0
html-webpack-plugin 5.3.2
Thanks for the error report ๐
The html-webpack-plugin consumes the final file names so it is very likely that this issue can only be improved by the ImageCompressionPlugin
Using ImageMinimizerPlugin as a standalone loader fixes the issue for me. see https://webpack.js.org/plugins/image-minimizer-webpack-plugin/#standalone-loader
This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.