解决前端项目安装依赖报错(图片压缩调整)

This commit is contained in:
秋帆
2024-03-24 10:12:53 +08:00
parent aa3eaebf6a
commit 1001ab4ac8
6 changed files with 2672 additions and 4143 deletions

View File

@@ -0,0 +1,11 @@
/**
* Image resource files used to compress the output of the production environment
* 图片压缩
* https://www.npmjs.com/package/vite-plugin-image-optimizer
*/
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
export default function configImageOptimizerPlugin() {
const imageOptimizerPlugin = ViteImageOptimizer();
return imageOptimizerPlugin;
}

View File

@@ -1,37 +0,0 @@
/**
* Image resource files used to compress the output of the production environment
* 图片压缩
* https://github.com/anncwb/vite-plugin-imagemin
*/
import viteImagemin from 'vite-plugin-imagemin';
export default function configImageminPlugin() {
const imageminPlugin = viteImagemin({
gifsicle: {
optimizationLevel: 7,
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
mozjpeg: {
quality: 20,
},
pngquant: {
quality: [0.8, 0.9],
speed: 4,
},
svgo: {
plugins: [
{
name: 'removeViewBox',
},
{
name: 'removeEmptyAttrs',
active: false,
},
],
},
});
return imageminPlugin;
}