1、npm install --save-dev image-webpack-loader
2、
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: [
{
loader: "url-loader",
options: {
limit: 1000,
name: utils.assetsPath("img/[name].[hash:5].[ext]")
}
},
{
loader: 'image-webpack-loader',// 压缩图片
}
]
},
网友评论