一、webpack 构建速度和体积优化的图片压缩、tree shaking、polyfill
- 图片压缩,要求是基于
Node库的imagemin或者tinypng API,使用时配置image-webpack-loader,代码如下所示:
return {
test: /\.(png|svg|jpg|gif|blob)$/,
use: [{
loader: 'file-loader',
options: {
name: `${
filename}img/[name]${
hash}.[ext]`
}, {
loader: 'image-webpack-loader',
options: {
mozjpeg: {
progressive: true,
quality

最低0.47元/天 解锁文章
1933

被折叠的 条评论
为什么被折叠?



