build: 升级 vite 版本(7.3.1 → 8.0.0)

This commit is contained in:
Ray.Hao
2026-03-16 11:55:05 +08:00
parent d6804fc4e0
commit c35403e197
5 changed files with 918 additions and 1112 deletions

View File

@@ -2,9 +2,9 @@
<img alt="vue3-element-admin" width="80" height="80" src="./src/assets/images/logo.png"> <img alt="vue3-element-admin" width="80" height="80" src="./src/assets/images/logo.png">
<h1>vue3-element-admin</h1> <h1>vue3-element-admin</h1>
<img src="https://img.shields.io/badge/Vue-3.5.22-brightgreen.svg"/> <img src="https://img.shields.io/badge/Vue-3.5.30-brightgreen.svg"/>
<img src="https://img.shields.io/badge/Vite-7.3.0-green.svg"/> <img src="https://img.shields.io/badge/Vite-8.0.0-green.svg"/>
<img src="https://img.shields.io/badge/Element Plus-2.3.2-blue.svg"/> <img src="https://img.shields.io/badge/Element Plus-2.13.5-blue.svg"/>
<img src="https://img.shields.io/badge/license-MIT-green.svg"/> <img src="https://img.shields.io/badge/license-MIT-green.svg"/>
<a href="https://gitee.com/youlaiorg/vue3-element-admin" target="_blank"> <a href="https://gitee.com/youlaiorg/vue3-element-admin" target="_blank">
@@ -30,7 +30,7 @@
## 项目简介 ## 项目简介
[vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) 基于 Vue3、Vite7、TypeScript 和 Element-Plus 搭建的极简开箱即用企业级后台管理前端模板。 配套 Java 后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot)、多租户后端 [youlai-boot-tenant](https://gitee.com/youlaiorg/youlai-boot-tenant) 和 Node 后端 [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) 。 提供开发简版[vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) 和 JS 版本[vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin) 供开发者快速开发。 [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) 基于 Vue3、Vite、TypeScript 和 Element-Plus 搭建的极简开箱即用企业级后台管理前端模板。 配套 Java 后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot)、多租户后端 [youlai-boot-tenant](https://gitee.com/youlaiorg/youlai-boot-tenant) 和 Node 后端 [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) 。 提供开发简版[vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) 和 JS 版本[vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin) 供开发者快速开发。
## 项目特色 ## 项目特色

View File

@@ -1,7 +1,7 @@
{ {
"name": "vue3-element-admin", "name": "vue3-element-admin",
"description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板vue-element-admin 的 Vue3 版本", "description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板vue-element-admin 的 Vue3 版本",
"version": "4.2.0", "version": "4.3.0",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -60,7 +60,7 @@
"codemirror": "^5.65.21", "codemirror": "^5.65.21",
"codemirror-editor-vue3": "^2.8.0", "codemirror-editor-vue3": "^2.8.0",
"echarts": "^6.0.0", "echarts": "^6.0.0",
"element-plus": "^2.13.3", "element-plus": "^2.13.5",
"exceljs": "^4.4.0", "exceljs": "^4.4.0",
"lodash-es": "^4.17.23", "lodash-es": "^4.17.23",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
@@ -69,63 +69,63 @@
"pinia": "^3.0.4", "pinia": "^3.0.4",
"qs": "^6.15.0", "qs": "^6.15.0",
"sortablejs": "^1.15.7", "sortablejs": "^1.15.7",
"vue": "^3.5.29", "vue": "^3.5.30",
"vue-draggable-plus": "^0.6.1", "vue-draggable-plus": "^0.6.1",
"vue-i18n": "^11.2.8", "vue-i18n": "^11.3.0",
"vue-router": "^5.0.3", "vue-router": "^5.0.3",
"vxe-table": "~4.6.25" "vxe-table": "~4.6.25"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^20.4.3", "@commitlint/cli": "^20.5.0",
"@commitlint/config-conventional": "^20.4.3", "@commitlint/config-conventional": "^20.5.0",
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
"@iconify/utils": "^3.1.0", "@iconify/utils": "^3.1.0",
"@testing-library/user-event": "^14.6.1", "@testing-library/user-event": "^14.6.1",
"@testing-library/vue": "^8.1.0", "@testing-library/vue": "^8.1.0",
"@types/codemirror": "^5.60.17", "@types/codemirror": "^5.60.17",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^25.3.3", "@types/node": "^25.5.0",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/path-browserify": "^1.0.3", "@types/path-browserify": "^1.0.3",
"@types/qs": "^6.14.0", "@types/qs": "^6.15.0",
"@types/sortablejs": "^1.15.9", "@types/sortablejs": "^1.15.9",
"@typescript-eslint/eslint-plugin": "^8.56.1", "@typescript-eslint/eslint-plugin": "^8.57.0",
"@typescript-eslint/parser": "^8.56.1", "@typescript-eslint/parser": "^8.57.0",
"@vitejs/plugin-vue": "^6.0.4", "@vitejs/plugin-vue": "^6.0.5",
"@vitest/ui": "^4.0.18", "@vitest/ui": "^4.1.0",
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"autoprefixer": "^10.4.27", "autoprefixer": "^10.4.27",
"commitizen": "^4.3.1", "commitizen": "^4.3.1",
"cz-git": "^1.12.0", "cz-git": "^1.12.0",
"eslint": "^10.0.2", "eslint": "^10.0.3",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5", "eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-vue": "^10.8.0", "eslint-plugin-vue": "^10.8.0",
"globals": "^17.4.0", "globals": "^17.4.0",
"happy-dom": "^20.8.3", "happy-dom": "^20.8.4",
"husky": "^9.1.7", "husky": "^9.1.7",
"lint-staged": "^16.2.7", "lint-staged": "^16.4.0",
"postcss": "^8.5.8", "postcss": "^8.5.8",
"postcss-html": "^1.8.1", "postcss-html": "^1.8.1",
"postcss-scss": "^4.0.9", "postcss-scss": "^4.0.9",
"prettier": "^3.8.1", "prettier": "^3.8.1",
"sass": "^1.97.3", "sass": "^1.98.0",
"stylelint": "^17.3.0", "stylelint": "^17.4.0",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^7.4.0", "stylelint-config-recess-order": "^7.6.1",
"stylelint-config-recommended": "^18.0.0", "stylelint-config-recommended": "^18.0.0",
"stylelint-config-recommended-scss": "^17.0.0", "stylelint-config-recommended-scss": "^17.0.0",
"stylelint-config-recommended-vue": "^1.6.1", "stylelint-config-recommended-vue": "^1.6.1",
"stylelint-prettier": "^5.0.3", "stylelint-prettier": "^5.0.3",
"terser": "^5.46.0", "terser": "^5.46.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.56.1", "typescript-eslint": "^8.57.0",
"unocss": "^66.6.4", "unocss": "^66.6.6",
"unplugin-auto-import": "^21.0.0", "unplugin-auto-import": "^21.0.0",
"unplugin-vue-components": "^31.0.0", "unplugin-vue-components": "^31.0.0",
"vite": "^7.3.1", "vite": "^8.0.0",
"vite-plugin-mock-dev-server": "^2.1.0", "vite-plugin-mock-dev-server": "^2.1.0",
"vitest": "^4.0.18", "vitest": "^4.1.0",
"vue-eslint-parser": "^10.4.0", "vue-eslint-parser": "^10.4.0",
"vue-tsc": "^3.2.5" "vue-tsc": "^3.2.5"
}, },

1957
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -38,7 +38,7 @@ const { locale, t } = useI18n();
/** /**
* 处理语言切换 * 处理语言切换
* *
* @param lang 语言(zh-cnã€<C3A3>enï¼? * @param lang 语言zh-cn、en<65>?
*/ */
function handleLanguageChange(lang: string) { function handleLanguageChange(lang: string) {
locale.value = lang; locale.value = lang;

View File

@@ -188,16 +188,19 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
"element-plus/es/components/space/style/index", "element-plus/es/components/space/style/index",
], ],
}, },
esbuild: isProduction
? {
drop: ["console", "debugger"],
}
: undefined,
// 构建配置 // 构建配置
build: { build: {
chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告
reportCompressedSize: false, reportCompressedSize: false,
minify: isProduction ? "esbuild" : false, // 只在生产环境启用压缩 minify: isProduction ? "terser" : false, // Vite 8 推荐使用 terser 进行生产压缩
terserOptions: isProduction
? {
compress: {
drop_console: true, // 生产环境移除 console
drop_debugger: true, // 生产环境移除 debugger
},
}
: undefined,
rollupOptions: { rollupOptions: {
output: { output: {
// manualChunks: { // manualChunks: {
@@ -209,6 +212,10 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
chunkFileNames: "js/[name].[hash].js", chunkFileNames: "js/[name].[hash].js",
// 用于输出静态资源的命名,[ext]表示文件扩展名 // 用于输出静态资源的命名,[ext]表示文件扩展名
assetFileNames: (assetInfo: any) => { assetFileNames: (assetInfo: any) => {
// Vite 8 / Rolldown: 添加空值保护
if (!assetInfo.name) {
return "assets/[name].[hash][extname]";
}
const info = assetInfo.name.split("."); const info = assetInfo.name.split(".");
let extType = info[info.length - 1]; let extType = info[info.length - 1];
// console.log('文件信息', assetInfo.name) // console.log('文件信息', assetInfo.name)