Skip to content

Commit

Permalink
Fix page import error
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxuanjun committed Oct 15, 2023
1 parent 380f32d commit b0afc7d
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
import { lazy } from 'solid-js'
import type { RouteDefinition } from '@solidjs/router'

type PageDefinition = {
path: string,
componentPath: string,
}

const pageList: PageDefinition[] = [
{ path: '/', componentPath: './pages/Home' },
{ path: '/resources', componentPath: './pages/Resources' },
{ path: '/words', componentPath: './pages/Words' },
{ path: '/posts', componentPath: './pages/Posts' },
{ path: '/projects', componentPath: './pages/Projects' },
{ path: '/dress', componentPath: './pages/Dress' },
{ path: '/about', componentPath: './pages/About' },
{ path: '**', componentPath: './pages/404' }
]

export const routes: RouteDefinition[] = pageList.map((page) => {
return {
path: page.path,
component: lazy(() => import( /* @vite-ignore */ page.componentPath))
export const routes: RouteDefinition[] = [
{
path: '/',
component: lazy(() => import('./pages/Home'))
},
{
path: '/resources',
component: lazy(() => import('./pages/Resources'))
},
{
path: '/words',
component: lazy(() => import('./pages/Words'))
},
{
path: '/posts',
component: lazy(() => import('./pages/Posts'))
},
{
path: '/projects',
component: lazy(() => import('./pages/Projects'))
},
{
path: '/dress',
component: lazy(() => import('./pages/Dress'))
},
{
path: '/about',
component: lazy(() => import('./pages/About'))
},
{
path: '**',
component: lazy(() => import('./pages/404'))
}
})
]

0 comments on commit b0afc7d

Please sign in to comment.