Hig*_*abs 5 angular-universal angular
我正在尝试在 Angular 应用程序版本 11 中实现预渲染。
运行命令后 npm run prerender我收到以下错误
Unable to extract routes from application.
Run Code Online (Sandbox Code Playgroud)
我的应用程序模块
const routes: Routes = [
{
path: '',
loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule),
}
];
Run Code Online (Sandbox Code Playgroud)
页面模块
const routes: Routes = [
{
path: '',
component: PageComponent,
children: [
{
path: '',
loadChildren: () => import('./home-page/home-page.module').then(m => m.HomePageModule),
},
{
path: 'about',
component: AboutComponent
},
{
path: 'tariff',
component: TariffComponent
},
{
path: 'contact',
component: ContactComponent
}
]
}
];
Run Code Online (Sandbox Code Playgroud)
我创建了一个routes.txt文件并添加了以下几行
/about
/traiff
/contact
Run Code Online (Sandbox Code Playgroud)
在 angular.json 文件中,
"prerender": {
"builder": "@nguniversal/builders:prerender",
"options": {
"browserTarget": "newTaxi:build:production",
"serverTarget": "newTaxi:server:production",
"routesFile": "./routes.txt"
},
"configurations": {
"production": {}
}
}
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?请指导我
| 归档时间: |
|
| 查看次数: |
2083 次 |
| 最近记录: |