import { Navigate, RouteObject } from 'react-router'

const modules = import.meta.glob('../modules/**/routes.tsx', { eager: true })

// 提取所有模块的路由
const moduleRoutes: RouteObject[] = Object.values(modules)
  .map((mod: any) => mod.routes)
  .flat()

// 定义路由表
const routes: RouteObject[] = [...moduleRoutes, { path: '*', element: <Navigate to="/data" /> }]

export default routes
