perf: 优化前端打包速度 (#5440)

pull/5442/head
zhengkunwang 2024-06-13 13:54:36 +08:00 committed by GitHub
parent b6f2497346
commit 99fc39d401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 39 additions and 49 deletions

View File

@ -20,51 +20,41 @@
"prettier": "prettier --write ."
},
"dependencies": {
"@codemirror/lang-javascript": "^6.1.0",
"@codemirror/language": "^6.3.2",
"@codemirror/legacy-modes": "^6.3.1",
"@codemirror/theme-one-dark": "^6.1.0",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/language": "^6.10.2",
"@codemirror/legacy-modes": "^6.4.0",
"@codemirror/theme-one-dark": "^6.1.2",
"@element-plus/icons-vue": "^1.1.4",
"@vueuse/core": "^8.0.1",
"axios": "^1.6.0",
"echarts": "^5.3.0",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.3.4",
"@vueuse/core": "^8.9.4",
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"axios": "^1.7.2",
"echarts": "^5.5.0",
"element-plus": "^2.7.5",
"fit2cloud-ui-plus": "^1.1.4",
"js-base64": "^3.7.2",
"js-md5": "^0.7.3",
"md-editor-v3": "^2.7.2",
"monaco-editor": "^0.34.0",
"js-base64": "^3.7.7",
"md-editor-v3": "^2.11.3",
"monaco-editor": "^0.34.1",
"nprogress": "^0.2.0",
"optionator": "^0.9.3",
"pinia": "^2.0.12",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^1.6.1",
"qs": "^6.10.3",
"sass-loader": "^13.0.2",
"qs": "^6.12.1",
"screenfull": "^6.0.2",
"unplugin-vue-define-options": "^0.7.3",
"vue": "^3.2.25",
"vue": "^3.4.27",
"vue-clipboard3": "^2.0.0",
"vue-codemirror": "^6.1.1",
"vue-i18n": "^9.10.2",
"vue-router": "^4.0.12",
"vue3-seamless-scroll": "^1.2.0",
"xterm": "^4.19.0",
"xterm-addon-attach": "^0.6.0",
"xterm-addon-fit": "^0.5.0"
"vue-i18n": "^9.13.1",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@commitlint/cli": "^17.0.1",
"@commitlint/config-conventional": "^17.0.0",
"@types/node": "^17.0.31",
"@types/node": "^20.14.2",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"@vitejs/plugin-vue": "^2.2.0",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vitejs/plugin-vue": "^5.0.5",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"autoprefixer": "^10.4.7",
"commitizen": "^4.2.4",
"cz-git": "^1.3.2",
"driver.js": "^0.9.8",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
@ -81,11 +71,10 @@
"typescript": "^4.5.4",
"unplugin-auto-import": "^0.16.4",
"unplugin-vue-components": "^0.25.0",
"vite": "^2.9.17",
"vite-plugin-cdn-import": "^0.3.5",
"vite": "^5.2.13",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.6.0",
"vite-plugin-html": "^3.2.0",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.2",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vite-svg-loader": "^5.1.0",
"vue-tsc": "^0.29.8"

View File

@ -4,9 +4,9 @@
<script lang="ts" setup>
import { ref, watch, onBeforeUnmount, nextTick } from 'vue';
import { Terminal } from 'xterm';
import 'xterm/css/xterm.css';
import { FitAddon } from 'xterm-addon-fit';
import { Terminal } from '@xterm/xterm';
import '@xterm/xterm/css/xterm.css';
import { FitAddon } from '@xterm/addon-fit';
import { Base64 } from 'js-base64';
const terminalElement = ref<HTMLDivElement | null>(null);

View File

@ -1,8 +1,8 @@
import fit2cloudEnLocale from 'fit2cloud-ui-plus/src/locale/lang/en';
let xpackEnLocale = {};
const xpackModules = import.meta.globEager('../../xpack/lang/en.ts');
const xpackModules = import.meta.glob('../../xpack/lang/en.ts', { eager: true });
if (xpackModules['../../xpack/lang/en.ts']) {
xpackEnLocale = xpackModules['../../xpack/lang/en.ts'].default || {};
xpackEnLocale = xpackModules['../../xpack/lang/en.ts']['default'] || {};
}
const message = {

View File

@ -1,8 +1,8 @@
import fit2cloudTwLocale from 'fit2cloud-ui-plus/src/locale/lang/zh-cn';
let xpackTwLocale = {};
const xpackModules = import.meta.globEager('../../xpack/lang/tw.ts');
const xpackModules = import.meta.glob('../../xpack/lang/tw.ts', { eager: true });
if (xpackModules['../../xpack/lang/tw.ts']) {
xpackTwLocale = xpackModules['../../xpack/lang/tw.ts'].default || {};
xpackTwLocale = xpackModules['../../xpack/lang/tw.ts']['default'] || {};
}
const message = {

View File

@ -1,8 +1,8 @@
import fit2cloudZhLocale from 'fit2cloud-ui-plus/src/locale/lang/zh-cn';
let xpackZhLocale = {};
const xpackModules = import.meta.globEager('../../xpack/lang/zh.ts');
const xpackModules = import.meta.glob('../../xpack/lang/zh.ts', { eager: true });
if (xpackModules['../../xpack/lang/zh.ts']) {
xpackZhLocale = xpackModules['../../xpack/lang/zh.ts'].default || {};
xpackZhLocale = xpackModules['../../xpack/lang/zh.ts']['default'] || {};
}
const message = {

View File

@ -1,8 +1,8 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import { Layout } from '@/routers/constant';
let modules = import.meta.globEager('./modules/*.ts');
const xpackModules = import.meta.globEager('../xpack/routers/*.ts');
let modules: Record<string, RouteRecordRaw> = import.meta.glob('./modules/*.ts', { eager: true });
const xpackModules: Record<string, RouteRecordRaw> = import.meta.glob('../xpack/routers/*.ts', { eager: true });
modules = { ...modules, ...xpackModules };
const homeRouter: RouteRecordRaw = {
@ -30,7 +30,7 @@ export const routerArray: RouteRecordRaw[] = [];
export const rolesRoutes = [
...Object.keys(modules)
.map((key) => modules[key].default)
.map((key) => modules[key]['default'])
.sort((r1, r2) => {
r1.sort ??= Number.MAX_VALUE;
r2.sort ??= Number.MAX_VALUE;
@ -47,6 +47,9 @@ export const menuList: RouteRecordRaw[] = [];
rolesRoutes.forEach((item) => {
let menuItem = JSON.parse(JSON.stringify(item));
let menuChildren: RouteRecordRaw[] = [];
if (menuItem.children == undefined) {
return;
}
menuItem.children.forEach((child: any) => {
if (child.hidden == undefined || child.hidden == false) {
menuChildren.push(child);

View File

@ -1,4 +1,2 @@
declare module 'nprogress';
declare module 'js-md5';
declare module 'echarts-liquidfill';
declare module 'qs';