router
Currently, to build the route config, we parse the files and create a tree of lazy loaded routes using loadChildren
at the leaf nodes to build the route config dynamically at runtime.
The produced result looks like this for /src/app/routes/about.ts
[
{
path: 'about',
loadChildren: () => import('./src/app/routes/about').then(m => [
{
component: m.default,
...m.routeMeta
}
}
]
To make this more static, we could parse the files, but create static imports for only the routeMeta, and lazy load the component
import { routeMeta as routeMeta_0_0 } from '/src/app/routes/about';
[
{
path: 'about',
loadComponent: () => import('/src/app/routes/about'),
...routeMeta_0_0
}
]
Parent/Child routes
import { routeMeta as routeMeta_0_0 } from '/src/app/routes/parent';
import { routeMeta as routeMeta_1_0 } from '/src/app/routes/parent/child';
[
{
path: 'parent',
loadComponent: () => import('/src/app/routes/parent'),
children: [
{
path: 'child',
loadComponent: () => import('/src/app/routes/parent/child'),
...routeMeta_1_0
}
]
}
]
Each file might require a routeMeta
export but that's TBD
No response
Owner Name | analogjs |
Repo Name | analog |
Full Name | analogjs/analog |
Language | TypeScript |
Created Date | 2022-07-06 |
Updated Date | 2023-03-28 |
Star Count | 885 |
Watcher Count | 18 |
Fork Count | 67 |
Issue Count | 33 |
Issue Title | Created Date | Updated Date |
---|