diff --git a/src/router/helper/routeHelper.tsx b/src/router/helper/routeHelper.tsx index 5ba9d67d4..979c3484e 100644 --- a/src/router/helper/routeHelper.tsx +++ b/src/router/helper/routeHelper.tsx @@ -4,7 +4,6 @@ import outsideLayout from '../routes/outsideLayout'; import type { RouteMeta, RouteRecordRaw } from 'vue-router'; import IFramePage from '@/components/basic/iframe-page'; import { warn } from '@/utils/log'; -import ComponentNotFound from '@/views/error/comp-not-found.vue'; import { rootRoute } from '@/router/routes'; import router from '@/router'; import basic from '@/router/routes/basic'; @@ -30,7 +29,7 @@ export const transformMenuToRoutes = (routeList: RouteRecordRaw[]) => { route.component = asyncRoutes[compPath]; // 前端 src/views 目录下无对应路由组件 if (!route.component) { - route.component = ComponentNotFound; + route.component = () => import('@/views/error/comp-not-found.vue'); warn(`在src/views/下找不到 ${compPath}.vue 或 ${compPath}.tsx, 请自行创建!`); } } diff --git a/vite.config.ts b/vite.config.ts index 8e15da3e2..fdcd245f1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -149,6 +149,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { return 'vendor'; } else if (id.includes('ant-design-vue')) { return 'vendor'; + } else if (id.includes('/src/api/index.ts')) { + return 'api'; } }, },