小编Hig*_*abs的帖子

预渲染角度应用程序时无法从应用程序中提取路线

我正在尝试在 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文件并添加了以下几行 …

angular-universal angular

5
推荐指数
0
解决办法
2083
查看次数

标签 统计

angular ×1

angular-universal ×1