From 096f96143a29c50ead82a012c95d34309828c19a Mon Sep 17 00:00:00 2001 From: sunlei Date: Sat, 25 Jul 2026 12:45:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=92=E9=99=A4=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6=E7=9A=84=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antdv-next/src/router/access.ts | 2 +- apps/web-antdv-next/src/router/routes/index.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/web-antdv-next/src/router/access.ts b/apps/web-antdv-next/src/router/access.ts index 1592b08..787f3bc 100644 --- a/apps/web-antdv-next/src/router/access.ts +++ b/apps/web-antdv-next/src/router/access.ts @@ -16,7 +16,7 @@ const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue'); async function generateAccess(options: GenerateMenuAndRoutesOptions) { const pageMap: ComponentRecordType = { - ...import.meta.glob('../views/**/*.tsx'), + ...import.meta.glob(['../views/**/*.tsx', '!../views/**/*.spec.tsx']), ...import.meta.glob('../views/**/*.vue'), }; diff --git a/apps/web-antdv-next/src/router/routes/index.ts b/apps/web-antdv-next/src/router/routes/index.ts index 15f6e5f..0e8c46c 100644 --- a/apps/web-antdv-next/src/router/routes/index.ts +++ b/apps/web-antdv-next/src/router/routes/index.ts @@ -4,9 +4,12 @@ import { mergeRouteModules, traverseTreeValues } from '@vben/utils'; import { coreRoutes, fallbackNotFoundRoute } from './core'; -const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', { - eager: true, -}); +const dynamicRouteFiles = import.meta.glob( + ['./modules/**/*.ts', '!./modules/**/*.spec.ts'], + { + eager: true, + }, +); // 有需要可以自行打开注释,并创建文件夹 // const externalRouteFiles = import.meta.glob('./external/**/*.ts', { eager: true }); @@ -30,7 +33,7 @@ const coreRouteNames = traverseTreeValues(coreRoutes, (route) => route.name); const accessRoutes = [...dynamicRoutes, ...staticRoutes]; const componentKeys: string[] = Object.keys({ - ...import.meta.glob('../../views/**/*.tsx'), + ...import.meta.glob(['../../views/**/*.tsx', '!../../views/**/*.spec.tsx']), ...import.meta.glob('../../views/**/*.vue'), }) .filter((item) => !item.includes('/modules/'))