// import { open, close } from '/src/helpers/loading'

const getRouterComponent = (name: string) => async () => {
  // const timer = setTimeout(() => {
  //   open()
  // }, 300)
  let res: Promise<any> = Promise.resolve(null)
  try {
    res = await import(/* @vite-ignore */ `../src/pages/${name}/index.tsx`)
  } catch (error) {
    res = Promise.reject()
  }
  // clearTimeout(timer)
  // close()
  return res
}


export default [
  {
    path: '/',
    component: getRouterComponent('home'),
  },
  {
    path: '/home',
    component: getRouterComponent('home'),
  },
  {
    path: '/login',
    component: getRouterComponent('login'),
  },
  {
    path: '/:pathMatch(.*)*',
    component: getRouterComponent('404'),
    meta: {
      title: '404 Not Fund'
    }
  }
]




// export default [
//   {
//     path: '/',
//     component: import(/* @vite-ignore */ `../src/pages/home/index`),
//   },
//   {
//     path: '/home',
//     component: import(/* @vite-ignore */ `../src/pages/home/index`),
//   },
//   {
//     path: '/login',
//     component: import(/* @vite-ignore */ `../src/pages/login/index`),
//   },
//   {
//     path: '/:pathMatch(.*)*',
//     component: import(/* @vite-ignore */ `../src/pages/404/index`),
//     meta: {
//       title: '404 Not Fund'
//     }
//   }
// ]