Files
EasyFlow/easyflow-ui-admin/app/vite.config.mts
陈子默 12080ceedb perf: 优化旧版浏览器页面恢复与资源加载
- 页面恢复时延后版本检查并补齐根背景,减少白闪与首帧卡顿

- 面向 Chrome 90 收敛公共分包,按需加载资源弹窗和知识库面板

- 压缩工作流图标并补充延迟加载与可见性生命周期测试
2026-07-31 16:11:14 +08:00

86 lines
2.3 KiB
TypeScript

import { fileURLToPath } from 'node:url';
import { defineConfig } from '@easyflow/vite-config';
import ElementPlus from 'unplugin-element-plus/vite';
import { createBasePathRedirectPlugin } from './vite-base-path-redirect';
const resourceListChunkEntries = [
'./src/components/headerSearch/HeaderSearch.vue',
'./src/components/page/CardList.vue',
'./src/components/page/PageData.vue',
'./src/components/page/PageSide.vue',
].map((file) => fileURLToPath(new URL(file, import.meta.url)));
function isResourceListModule(id: string) {
return resourceListChunkEntries.some(
(entry) => id === entry || id.startsWith(`${entry}?`),
);
}
export default defineConfig(async () => {
return {
application: {},
vite: {
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (isResourceListModule(id)) {
return 'resource-list';
}
},
onlyExplicitManualChunks: true,
},
},
},
resolve: {
alias: {
// @vueuse/motion expects tslib default export during dev pre-bundling
// and breaks when Vite resolves to ESM-only modules/index.js.
tslib: 'tslib/tslib.js',
},
},
plugins: [
createBasePathRedirectPlugin(),
ElementPlus({
format: 'esm',
}),
],
server: {
proxy: {
'/flow/api': {
changeOrigin: true,
headers: {
'X-Forwarded-Prefix': '/flow',
},
rewrite: (path) => path.replace(/^\/flow/, ''),
target: 'http://127.0.0.1:8111',
ws: true,
xfwd: true,
},
'/flow/public-api': {
changeOrigin: true,
headers: {
'X-Forwarded-Prefix': '/flow',
},
rewrite: (path) => path.replace(/^\/flow/, ''),
target: 'http://127.0.0.1:8111',
xfwd: true,
},
'/flow/userCenter': {
changeOrigin: true,
headers: {
'X-Forwarded-Prefix': '/flow',
},
rewrite: (path) => path.replace(/^\/flow/, ''),
target: 'http://127.0.0.1:8111',
xfwd: true,
},
},
},
},
};
});