chore: update vite 4.2

pull/3/head
xingyuv 2023-03-23 10:47:04 +08:00
parent 0c23071d90
commit 4ed6b166d1
5 changed files with 35 additions and 143 deletions

View File

@ -1,40 +0,0 @@
/**
* Plugin to minimize and use ejs template syntax in index.html.
* https://github.com/anncwb/vite-plugin-html
*/
import type { PluginOption } from 'vite'
import { createHtmlPlugin } from 'vite-plugin-html'
import pkg from '../../../package.json'
import { GLOB_CONFIG_FILE_NAME } from '../../constant'
export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
const { VITE_GLOB_APP_TITLE, VITE_PUBLIC_PATH } = env
const path = VITE_PUBLIC_PATH.endsWith('/') ? VITE_PUBLIC_PATH : `${VITE_PUBLIC_PATH}/`
const getAppConfigSrc = () => {
return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`
}
const htmlPlugin: PluginOption[] = createHtmlPlugin({
minify: isBuild,
inject: {
// Inject data into ejs template
data: {
title: VITE_GLOB_APP_TITLE
},
// Embed the generated app.config.js file
tags: isBuild
? [
{
tag: 'script',
attrs: {
src: getAppConfigSrc()
}
}
]
: []
}
})
return htmlPlugin
}

View File

@ -7,7 +7,6 @@ import windiCSS from 'vite-plugin-windicss'
import purgeIcons from 'vite-plugin-purge-icons'
import VitePluginCertificate from 'vite-plugin-mkcert'
import vueSetupExtend from 'unplugin-vue-setup-extend-plus/vite'
import { configHtmlPlugin } from './html'
import { configPwaConfig } from './pwa'
import { configCompressPlugin } from './compress'
import { configStyleImportPlugin } from './styleImport'
@ -39,9 +38,6 @@ export function createVitePlugins(mode: string, viteEnv: ViteEnv, isBuild: boole
// @vitejs/plugin-legacy
VITE_LEGACY && isBuild && vitePlugins.push(legacy())
// vite-plugin-html
vitePlugins.push(configHtmlPlugin(viteEnv, isBuild))
// vite-plugin-svg-icons
vitePlugins.push(configSvgIconsPlugin(isBuild))

View File

@ -8,7 +8,7 @@
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<title><%= title %></title>
<title>%VITE_GLOB_APP_TITLE%</title>
<link rel="icon" href="/favicon.ico" />
</head>
<body>
@ -149,7 +149,7 @@
<div class="app-loading-dots">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
<div class="app-loading-title"><%= title %></div>
<div class="app-loading-title">%VITE_GLOB_APP_TITLE%</div>
</div>
</div>
</div>

View File

@ -41,6 +41,7 @@
"ant-design-vue": "^3.2.15",
"axios": "^1.3.4",
"codemirror": "^5.65.3",
"consola": "^2.15.3",
"cropperjs": "^1.5.13",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.7",
@ -59,7 +60,7 @@
"vditor": "^3.9.1",
"vue": "^3.2.47",
"vue-i18n": "^9.2.2",
"vue-json-pretty": "^2.2.3",
"vue-json-pretty": "^2.2.4",
"vue-router": "^4.1.6",
"vue-types": "^5.0.2",
"xlsx": "^0.18.5"
@ -67,7 +68,7 @@
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@iconify/json": "^2.2.37",
"@iconify/json": "^2.2.38",
"@kirklin/vite-plugin-vben-theme": "^0.1.1",
"@purge-icons/generated": "^0.9.0",
"@types/codemirror": "^5.60.5",
@ -88,11 +89,10 @@
"@vitejs/plugin-vue-jsx": "^3.0.1",
"@vue/compiler-sfc": "^3.2.47",
"autoprefixer": "^10.4.14",
"consola": "^2.15.3",
"conventional-changelog-cli": "^2.2.2",
"cross-env": "^7.0.3",
"cz-git": "^1.6.0",
"czg": "^1.6.0",
"cz-git": "^1.6.1",
"czg": "^1.6.1",
"dotenv": "^16.0.3",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
@ -109,7 +109,7 @@
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
"prettier": "^2.8.6",
"rimraf": "^4.4.0",
"rimraf": "^4.4.1",
"rollup": "^3.20.0",
"rollup-plugin-visualizer": "^5.9.0",
"stylelint": "^14.16.1",
@ -123,11 +123,10 @@
"unplugin-vue-setup-extend-plus": "^0.4.9",
"vite": "^4.2.1",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-mkcert": "^1.13.3",
"vite-plugin-progress": "^0.0.6",
"vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-pwa": "^0.14.4",
"vite-plugin-pwa": "^0.14.5",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-windicss": "^1.8.10",

View File

@ -6,7 +6,7 @@ specifiers:
'@commitlint/cli': ^17.4.4
'@commitlint/config-conventional': ^17.4.4
'@iconify/iconify': ^3.1.0
'@iconify/json': ^2.2.37
'@iconify/json': ^2.2.38
'@kirklin/vite-plugin-vben-theme': ^0.1.1
'@purge-icons/generated': ^0.9.0
'@types/codemirror': ^5.60.5
@ -38,8 +38,8 @@ specifiers:
cropperjs: ^1.5.13
cross-env: ^7.0.3
crypto-js: ^4.1.1
cz-git: ^1.6.0
czg: ^1.6.0
cz-git: ^1.6.1
czg: ^1.6.1
dayjs: ^1.11.7
dotenv: ^16.0.3
echarts: ^5.4.1
@ -67,7 +67,7 @@ specifiers:
qrcode: ^1.5.1
qs: ^6.11.1
resize-observer-polyfill: ^1.5.1
rimraf: ^4.4.0
rimraf: ^4.4.1
rollup: ^3.20.0
rollup-plugin-visualizer: ^5.9.0
sortablejs: ^1.15.0
@ -84,18 +84,17 @@ specifiers:
vditor: ^3.9.1
vite: ^4.2.1
vite-plugin-compression: ^0.5.1
vite-plugin-html: ^3.2.0
vite-plugin-mkcert: ^1.13.3
vite-plugin-progress: ^0.0.6
vite-plugin-purge-icons: ^0.9.2
vite-plugin-pwa: ^0.14.4
vite-plugin-pwa: ^0.14.5
vite-plugin-style-import: ^2.0.0
vite-plugin-svg-icons: ^2.0.1
vite-plugin-windicss: ^1.8.10
vue: ^3.2.47
vue-eslint-parser: ^9.1.0
vue-i18n: ^9.2.2
vue-json-pretty: ^2.2.3
vue-json-pretty: ^2.2.4
vue-router: ^4.1.6
vue-tsc: ^1.2.0
vue-types: ^5.0.2
@ -111,6 +110,7 @@ dependencies:
ant-design-vue: 3.2.15_vue@3.2.47
axios: 1.3.4
codemirror: 5.65.12
consola: 2.15.3
cropperjs: 1.5.13
crypto-js: 4.1.1
dayjs: 1.11.7
@ -129,7 +129,7 @@ dependencies:
vditor: 3.9.1
vue: 3.2.47
vue-i18n: 9.2.2_vue@3.2.47
vue-json-pretty: 2.2.3_vue@3.2.47
vue-json-pretty: 2.2.4_vue@3.2.47
vue-router: 4.1.6_vue@3.2.47
vue-types: 5.0.2_vue@3.2.47
xlsx: 0.18.5
@ -137,7 +137,7 @@ dependencies:
devDependencies:
'@commitlint/cli': 17.4.4
'@commitlint/config-conventional': 17.4.4
'@iconify/json': 2.2.37
'@iconify/json': 2.2.38
'@kirklin/vite-plugin-vben-theme': 0.1.1_vite@4.2.1
'@purge-icons/generated': 0.9.0
'@types/codemirror': 5.60.7
@ -158,11 +158,10 @@ devDependencies:
'@vitejs/plugin-vue-jsx': 3.0.1_vite@4.2.1+vue@3.2.47
'@vue/compiler-sfc': 3.2.47
autoprefixer: 10.4.14_postcss@8.4.21
consola: 2.15.3
conventional-changelog-cli: 2.2.2
cross-env: 7.0.3
cz-git: 1.6.0
czg: 1.6.0
cz-git: 1.6.1
czg: 1.6.1
dotenv: 16.0.3
eslint: 8.36.0
eslint-config-prettier: 8.8.0_eslint@8.36.0
@ -179,7 +178,7 @@ devDependencies:
postcss-html: 1.5.0
postcss-less: 6.0.0_postcss@8.4.21
prettier: 2.8.6
rimraf: 4.4.0
rimraf: 4.4.1
rollup: 3.20.0
rollup-plugin-visualizer: 5.9.0_rollup@3.20.0
stylelint: 14.16.1
@ -193,11 +192,10 @@ devDependencies:
unplugin-vue-setup-extend-plus: 0.4.9
vite: 4.2.1_vegyvzqowfnzsveoljeroqfyum
vite-plugin-compression: 0.5.1_vite@4.2.1
vite-plugin-html: 3.2.0_vite@4.2.1
vite-plugin-mkcert: 1.13.3_vite@4.2.1
vite-plugin-progress: 0.0.6_vite@4.2.1
vite-plugin-purge-icons: 0.9.2_vite@4.2.1
vite-plugin-pwa: 0.14.4_vite@4.2.1
vite-plugin-pwa: 0.14.5_vite@4.2.1
vite-plugin-style-import: 2.0.0_vite@4.2.1
vite-plugin-svg-icons: 2.0.1_vite@4.2.1
vite-plugin-windicss: 1.8.10_vite@4.2.1
@ -1934,8 +1932,8 @@ packages:
dependencies:
'@iconify/types': 2.0.0
/@iconify/json/2.2.37:
resolution: {integrity: sha512-3PHw+H9hMUYZ+wUij6DmdWxBnBIYOMtsKGRrJUHsKhMloy4kcOu+Yi2XKfD8JvXgJ6ybzoNAXOkKDgEqY0JKQw==}
/@iconify/json/2.2.38:
resolution: {integrity: sha512-/rILbwnpDy7c82vyaOl7AYLozohNrNjhiQpBp1lI2r9IDzhcA18tfogdeP7S7WWdhy4fxIlebVnsEi0Ql4fQIA==}
dependencies:
'@iconify/types': 2.0.0
pathe: 1.1.0
@ -3569,11 +3567,6 @@ packages:
engines: {node: '>= 10'}
dev: true
/commander/8.3.0:
resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}
engines: {node: '>= 12'}
dev: true
/common-tags/1.8.2:
resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==}
engines: {node: '>=4.0.0'}
@ -3598,14 +3591,9 @@ packages:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
dev: true
/connect-history-api-fallback/1.6.0:
resolution: {integrity: sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==}
engines: {node: '>=0.8'}
dev: true
/consola/2.15.3:
resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==}
dev: true
dev: false
/console/0.7.2:
resolution: {integrity: sha512-+JSDwGunA4MTEgAV/4VBKwUHonP8CzJ/6GIuwPi6acKFqFfHUdSGCm89ZxZ5FfGWdZfkdgAroy5bJ5FSeN/t4g==}
@ -3951,12 +3939,12 @@ packages:
/csstype/2.6.21:
resolution: {integrity: sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==}
/cz-git/1.6.0:
resolution: {integrity: sha512-eOGpDlYtY9qcJ+PC9Rg+Dk0aDrk6azkOOU5z52MJzKm11mtIMQIzqCtvsM7fHYschiQ0NCcrg5pNr9JaxtVA1A==}
/cz-git/1.6.1:
resolution: {integrity: sha512-+ohk/MFETERw4o/WpN3hUk7GM8oAwnaQI/uDuREGm4/B+G3DghGvNZQ/0MbFqZHWgKWvMzNZI6eKmPo0uPCu1A==}
dev: true
/czg/1.6.0:
resolution: {integrity: sha512-bFAXzGUrwanQ/VDL+s6zhoXxZbZNHCoAF0R2VAaHoFNpyAFeOrQ66TLP7FydaRsnXdBzRazfN+BUVdKUkyoHGw==}
/czg/1.6.1:
resolution: {integrity: sha512-F6xzZ+ooLqCOLdsT7miEZRInaTjoglY5CjT5Hc4Yg9gxwLS2zjfUUFGvemVgUZI+ggzFAHE6VL0PA+4ukbOWgQ==}
hasBin: true
dev: true
@ -4210,11 +4198,6 @@ packages:
is-obj: 2.0.0
dev: true
/dotenv-expand/8.0.3:
resolution: {integrity: sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==}
engines: {node: '>=12'}
dev: true
/dotenv/16.0.3:
resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==}
engines: {node: '>=12'}
@ -5436,20 +5419,6 @@ packages:
lru-cache: 6.0.0
dev: true
/html-minifier-terser/6.1.0:
resolution: {integrity: sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==}
engines: {node: '>=12'}
hasBin: true
dependencies:
camel-case: 4.1.2
clean-css: 5.3.2
commander: 8.3.0
he: 1.2.0
param-case: 3.0.4
relateurl: 0.2.7
terser: 5.16.6
dev: true
/html-tags/3.2.0:
resolution: {integrity: sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==}
engines: {node: '>=8'}
@ -6647,13 +6616,6 @@ packages:
whatwg-url: 5.0.0
dev: true
/node-html-parser/5.4.2:
resolution: {integrity: sha512-RaBPP3+51hPne/OolXxcz89iYvQvKOydaqoePpOgXcrOKZhjVIzmpKZz+Hd/RBO2/zN2q6CNJhQzucVz+u3Jyw==}
dependencies:
css-select: 4.3.0
he: 1.2.0
dev: true
/node-releases/2.0.10:
resolution: {integrity: sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==}
dev: true
@ -7399,11 +7361,6 @@ packages:
jsesc: 0.5.0
dev: true
/relateurl/0.2.7:
resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==}
engines: {node: '>= 0.10'}
dev: true
/repeat-element/1.1.4:
resolution: {integrity: sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==}
engines: {node: '>=0.10.0'}
@ -7499,8 +7456,8 @@ packages:
glob: 7.2.3
dev: true
/rimraf/4.4.0:
resolution: {integrity: sha512-X36S+qpCUR0HjXlkDe4NAOhS//aHH0Z+h8Ckf2auGJk3PTnx5rLmrHkwNdbVQuCSUhOyFrlRvFEllZOYE+yZGQ==}
/rimraf/4.4.1:
resolution: {integrity: sha512-Gk8NlF062+T9CqNGn6h4tls3k6T1+/nXdOcSZVikNVtlRdYpA7wRJJMoXmuvOnLW844rPjdQ7JgXCYM6PPC/og==}
engines: {node: '>=14'}
hasBin: true
dependencies:
@ -8651,26 +8608,6 @@ packages:
- supports-color
dev: true
/vite-plugin-html/3.2.0_vite@4.2.1:
resolution: {integrity: sha512-2VLCeDiHmV/BqqNn5h2V+4280KRgQzCFN47cst3WiNK848klESPQnzuC3okH5XHtgwHH/6s1Ho/YV6yIO0pgoQ==}
peerDependencies:
vite: '>=2.0.0'
dependencies:
'@rollup/pluginutils': 4.2.1
colorette: 2.0.19
connect-history-api-fallback: 1.6.0
consola: 2.15.3
dotenv: 16.0.3
dotenv-expand: 8.0.3
ejs: 3.1.8
fast-glob: 3.2.12
fs-extra: 10.1.0
html-minifier-terser: 6.1.0
node-html-parser: 5.4.2
pathe: 0.2.0
vite: 4.2.1_vegyvzqowfnzsveoljeroqfyum
dev: true
/vite-plugin-mkcert/1.13.3_vite@4.2.1:
resolution: {integrity: sha512-cuAbOb6bHyTMhha9YimL6ZB/WoCcFy8d3uaf5n5Ovgybix1yvEu3pxARy2HjC5LJIS1qq6fFXG0+oj6/XMUapA==}
engines: {node: '>=v16.7.0'}
@ -8714,8 +8651,8 @@ packages:
- supports-color
dev: true
/vite-plugin-pwa/0.14.4_vite@4.2.1:
resolution: {integrity: sha512-M7Ct0so8OlouMkTWgXnl8W1xU95glITSKIe7qswZf1tniAstO2idElGCnsrTJ5NPNSx1XqfTCOUj8j94S6FD7Q==}
/vite-plugin-pwa/0.14.5_vite@4.2.1:
resolution: {integrity: sha512-LH3VCtoWx0scfim8Ph+daVl45uVRyWzXn3C3GUq92uWUui1p8eh+DjTQ23Pvb7SJ0SJtxZ99LCpOLCkFkaxokg==}
peerDependencies:
vite: ^3.1.0 || ^4.0.0
dependencies:
@ -8861,8 +8798,8 @@ packages:
vue: 3.2.47
dev: false
/vue-json-pretty/2.2.3_vue@3.2.47:
resolution: {integrity: sha512-tJo+4eFclQBt3gJ6EELXNdvo50wDKTZYthwmLpy9YS7UDldeJln5ff+IpdmUglfk+FqLVOX/re0+Ni/EOUPZgw==}
/vue-json-pretty/2.2.4_vue@3.2.47:
resolution: {integrity: sha512-JX80b3QDrspcH43C53CdtYeq/froApQGSV5y43bEMWFj2LGOxB96aH1VmvrFA21nD1WTP6nwfFMQqGXuS4jyFQ==}
engines: {node: '>= 10.0.0', npm: '>= 5.0.0'}
peerDependencies:
vue: '>=3.0.0'