This commit is contained in:
张成
2022-08-03 16:04:18 +08:00
parent 9fe65778e4
commit f4f59fd64d
2 changed files with 41 additions and 21 deletions

View File

@@ -17,21 +17,41 @@ module.exports = {
config.resolve.alias.set("@", resolve("src"));
config.resolve.alias.set("_c", resolve("src/components"));
config.module.rule('images').test(/\.(png|jpe?g|gif)(\?.*)?$/).use('url-loader').loader('url-loader').options({
limit: 10000,
esModule: false,
outputPath: "images/"
})
config.module.rule('images')
.test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
.test(/\.(png|jpe?g|gif)(\?.*)?$/)
.use('image-webpack-loader')
.loader('image-webpack-loader')
.options({
bypassOnDebug: true,
mozjpeg: {
progressive: true,
quality: 65
},
optipng: {
enabled: false,
},
pngquant: {
quality: [0.65, 0.90],
speed: 4
},
gifsicle: {
interlaced: false,
},
webp: {
quality: 75
}
})
config.module.rule('images').use('url-loader').loader('url-loader').options({
limit: 2,
esModule: false,
outputPath: "img/"
})
},