fix: 优化构建速度,更新 Element Plus 样式变量及 API 接口
This commit is contained in:
@@ -26,7 +26,24 @@ export default defineMock([
|
|||||||
tokenType: "Bearer",
|
tokenType: "Bearer",
|
||||||
refreshToken:
|
refreshToken:
|
||||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA",
|
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA",
|
||||||
expiresIn: null,
|
expiresIn: 7200,
|
||||||
|
},
|
||||||
|
msg: "一切ok",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
url: "auth/refresh-token",
|
||||||
|
method: ["POST"],
|
||||||
|
body: {
|
||||||
|
code: "00000",
|
||||||
|
data: {
|
||||||
|
accessToken:
|
||||||
|
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA",
|
||||||
|
tokenType: "Bearer",
|
||||||
|
refreshToken:
|
||||||
|
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA",
|
||||||
|
expiresIn: 7200,
|
||||||
},
|
},
|
||||||
msg: "一切ok",
|
msg: "一切ok",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ export default defineMock([
|
|||||||
|
|
||||||
// 导出Excel
|
// 导出Excel
|
||||||
{
|
{
|
||||||
url: "users/_export",
|
url: "users/export",
|
||||||
method: ["GET"],
|
method: ["GET"],
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Disposition": "attachment; filename=%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8.xlsx",
|
"Content-Disposition": "attachment; filename=%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8.xlsx",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit & vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { createApp } from "vue";
|
|||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
|
|
||||||
// ===== 样式导入 =====
|
// ===== 样式导入 =====
|
||||||
|
import "element-plus/dist/index.css";
|
||||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||||
import "vxe-table/lib/style.css";
|
import "vxe-table/lib/style.css";
|
||||||
import "@/styles/index.scss";
|
import "@/styles/index.scss";
|
||||||
|
|||||||
@@ -1,6 +1,50 @@
|
|||||||
// Element Plus 变量覆盖(必须在最前面)
|
// Element Plus 变量覆盖(必须在最前面)
|
||||||
@use "./element-plus-vars";
|
@use "./element-plus-vars";
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--el-color-primary: #4080ff;
|
||||||
|
--el-color-primary-dark-2: color-mix(in srgb, var(--el-color-primary) 80%, #000);
|
||||||
|
--el-color-primary-light-3: color-mix(in srgb, var(--el-color-primary) 30%, #fff);
|
||||||
|
--el-color-primary-light-5: color-mix(in srgb, var(--el-color-primary) 50%, #fff);
|
||||||
|
--el-color-primary-light-7: color-mix(in srgb, var(--el-color-primary) 70%, #fff);
|
||||||
|
--el-color-primary-light-8: color-mix(in srgb, var(--el-color-primary) 80%, #fff);
|
||||||
|
--el-color-primary-light-9: color-mix(in srgb, var(--el-color-primary) 90%, #fff);
|
||||||
|
|
||||||
|
--el-color-success: #23c343;
|
||||||
|
--el-color-success-dark-2: color-mix(in srgb, var(--el-color-success) 80%, #000);
|
||||||
|
--el-color-success-light-3: color-mix(in srgb, var(--el-color-success) 30%, #fff);
|
||||||
|
--el-color-success-light-5: color-mix(in srgb, var(--el-color-success) 50%, #fff);
|
||||||
|
--el-color-success-light-7: color-mix(in srgb, var(--el-color-success) 70%, #fff);
|
||||||
|
--el-color-success-light-8: color-mix(in srgb, var(--el-color-success) 80%, #fff);
|
||||||
|
--el-color-success-light-9: color-mix(in srgb, var(--el-color-success) 90%, #fff);
|
||||||
|
|
||||||
|
--el-color-warning: #ff9a2e;
|
||||||
|
--el-color-warning-dark-2: color-mix(in srgb, var(--el-color-warning) 80%, #000);
|
||||||
|
--el-color-warning-light-3: color-mix(in srgb, var(--el-color-warning) 30%, #fff);
|
||||||
|
--el-color-warning-light-5: color-mix(in srgb, var(--el-color-warning) 50%, #fff);
|
||||||
|
--el-color-warning-light-7: color-mix(in srgb, var(--el-color-warning) 70%, #fff);
|
||||||
|
--el-color-warning-light-8: color-mix(in srgb, var(--el-color-warning) 80%, #fff);
|
||||||
|
--el-color-warning-light-9: color-mix(in srgb, var(--el-color-warning) 90%, #fff);
|
||||||
|
|
||||||
|
--el-color-danger: #f76560;
|
||||||
|
--el-color-danger-dark-2: color-mix(in srgb, var(--el-color-danger) 80%, #000);
|
||||||
|
--el-color-danger-light-3: color-mix(in srgb, var(--el-color-danger) 30%, #fff);
|
||||||
|
--el-color-danger-light-5: color-mix(in srgb, var(--el-color-danger) 50%, #fff);
|
||||||
|
--el-color-danger-light-7: color-mix(in srgb, var(--el-color-danger) 70%, #fff);
|
||||||
|
--el-color-danger-light-8: color-mix(in srgb, var(--el-color-danger) 80%, #fff);
|
||||||
|
--el-color-danger-light-9: color-mix(in srgb, var(--el-color-danger) 90%, #fff);
|
||||||
|
|
||||||
|
--el-color-info: #a9aeb8;
|
||||||
|
--el-color-info-dark-2: color-mix(in srgb, var(--el-color-info) 80%, #000);
|
||||||
|
--el-color-info-light-3: color-mix(in srgb, var(--el-color-info) 30%, #fff);
|
||||||
|
--el-color-info-light-5: color-mix(in srgb, var(--el-color-info) 50%, #fff);
|
||||||
|
--el-color-info-light-7: color-mix(in srgb, var(--el-color-info) 70%, #fff);
|
||||||
|
--el-color-info-light-8: color-mix(in srgb, var(--el-color-info) 80%, #fff);
|
||||||
|
--el-color-info-light-9: color-mix(in srgb, var(--el-color-info) 90%, #fff);
|
||||||
|
|
||||||
|
--el-bg-color-page: #f5f8fd;
|
||||||
|
}
|
||||||
|
|
||||||
$border: 1px solid var(--el-border-color-light);
|
$border: 1px solid var(--el-border-color-light);
|
||||||
|
|
||||||
/* el-dialog */
|
/* el-dialog */
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||||||
// 指定自定义组件位置(默认:src/components)
|
// 指定自定义组件位置(默认:src/components)
|
||||||
dirs: ["src/components", "src/**/components"],
|
dirs: ["src/components", "src/**/components"],
|
||||||
// 导入组件类型声明文件路径 (false:关闭自动生成)
|
// 导入组件类型声明文件路径 (false:关闭自动生成)
|
||||||
dts: "src/types/components.d.ts",
|
dts: false,
|
||||||
|
//dts: "src/types/components.d.ts",
|
||||||
}),
|
}),
|
||||||
] as PluginOption[],
|
] as PluginOption[],
|
||||||
// 预加载项目必需的组件
|
// 预加载项目必需的组件
|
||||||
@@ -188,23 +189,16 @@ 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警告
|
||||||
minify: isProduction ? "terser" : false, // 只在生产环境启用压缩
|
reportCompressedSize: false,
|
||||||
terserOptions: isProduction
|
minify: isProduction ? "esbuild" : false, // 只在生产环境启用压缩
|
||||||
? {
|
|
||||||
compress: {
|
|
||||||
keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题
|
|
||||||
drop_console: true, // 生产环境去除 console.log, console.warn, console.error 等
|
|
||||||
drop_debugger: true, // 生产环境去除 debugger
|
|
||||||
pure_funcs: ["console.log", "console.info"], // 移除指定的函数调用
|
|
||||||
},
|
|
||||||
format: {
|
|
||||||
comments: false, // 删除注释
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: {},
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
// manualChunks: {
|
// manualChunks: {
|
||||||
|
|||||||
Reference in New Issue
Block a user