🚀 feat: add imageCompression

This commit is contained in:
chuzhixin 2023-01-09 06:35:22 +08:00
parent ae2f8dfefc
commit 349e4c8902
5 changed files with 20 additions and 19 deletions

View File

@ -59,7 +59,7 @@
```bash
git clone -b vue3.0-antdv https://github.com/chuzhixin/vue-admin-better.git
npm i
npm i --registry=http://mirrors.cloud.tencent.com/npm/
npm run serve
```
@ -67,7 +67,7 @@ npm run serve
```bash
git clone -b master https://github.com/chuzhixin/vue-admin-better.git
npm i
npm i --registry=http://mirrors.cloud.tencent.com/npm/
npm run serve
```

View File

@ -80,7 +80,7 @@
# 克隆项目
git clone -b vue3.0-antdv https://github.com/chuzhixin/vue-admin-better.git
# 安装依赖
npm i
npm i --registry=http://mirrors.cloud.tencent.com/npm/
# 本地开发 启动项目
npm run serve
```
@ -91,7 +91,7 @@ npm run serve
# 克隆项目
git clone https://github.com/chuzhixin/vue-admin-arco.git
# 安装依赖
npm i
npm i --registry=http://mirrors.cloud.tencent.com/npm/
# 本地开发 启动项目
npm run dev
```
@ -102,7 +102,7 @@ npm run dev
# 克隆项目
git clone -b master https://github.com/chuzhixin/vue-admin-better.git
# 安装依赖
npm i
npm i --registry=http://mirrors.cloud.tencent.com/npm/
# 本地开发 启动项目
npm run serve
```

View File

@ -11,16 +11,13 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"build:report": "vue-cli-service build --report",
"globle": "npm install -g cnpm --registry=https://registry.npmmirror.com&&cnpm i rimraf npm-check-updates nrm -g&&rimraf node_modules&&cnpm i",
"globle": "npm install -g cnpm --registry=http://mirrors.cloud.tencent.com/npm/&&cnpm i rimraf npm-check-updates nrm -g&&rimraf node_modules&&cnpm i",
"lint": "vue-cli-service lint",
"lint:style": "stylelint-config-prettier-check",
"inspect": "vue-cli-service inspect",
"template": "plop",
"clear": "rimraf node_modules&&npm install --registry=https://registry.npmmirror.com",
"clear": "rimraf node_modules&&npm install --registry=http://mirrors.cloud.tencent.com/npm/",
"image-webpack-loader": "cnpm i image-webpack-loader -D",
"use:npm": "nrm use npm",
"use:taobao": "nrm use taobao",
"update": "ncu -u --reject sass-loader,sass,screenfull,eslint,chalk,vue-echarts,vue,vue-template-compiler,vue-router,vuex,@vue/cli-plugin-babel,@vue/cli-plugin-eslint,@vue/cli-service,eslint-plugin-vue --registry https://registry.npmmirror.com&&cnpm i",
"update": "ncu -u --reject sass-loader,sass,screenfull,eslint,chalk,vue-echarts,vue,vue-template-compiler,vue-router,vuex,@vue/cli-plugin-babel,@vue/cli-plugin-eslint,@vue/cli-service,eslint-plugin-vue --registry=http://mirrors.cloud.tencent.com/npm/&&npm i --registry=http://mirrors.cloud.tencent.com/npm/",
"update:globle": "ncu -g --concurrency 10 --timeout 80000",
"push": "start ./push.sh",
"deploy": "start ./deploy.sh"

View File

@ -66,5 +66,7 @@ const setting = {
templateFolder: 'project',
//donation
donation: true,
//
imageCompression: true,
}
module.exports = setting

View File

@ -16,6 +16,7 @@ const {
providePlugin,
build7z,
donation,
imageCompression,
} = require('./src/config')
const { webpackBarName, webpackBanner, donationConsole } = require('zx-layouts')
@ -141,14 +142,15 @@ module.exports = {
.plugin('banner')
.use(Webpack.BannerPlugin, [`${webpackBanner}${time}`])
.end()
config.module
.rule('images')
.use('image-webpack-loader')
.loader('image-webpack-loader')
.options({
bypassOnDebug: true,
})
.end()
if (imageCompression)
config.module
.rule('images')
.use('image-webpack-loader')
.loader('image-webpack-loader')
.options({
bypassOnDebug: true,
})
.end()
})
if (build7z) {