Angular 8 не может найти ленивый загруженный модуль - PullRequest
0 голосов
/ 26 марта 2020

У меня есть функциональный модуль ClientsModule, который импортирован в AppModule, и по какой-то причине 1 и только 1 из моих дочерних модулей DocumentsPageModule по какой-то причине не найден. Я начну сверху вниз, чтобы показать иерархию:

Общая иерархия

app.module
  -pages
    -clients 
      -clients.module.ts (ClientsModule)
      -clients-routing-module.ts (ClientsRoutingModule)
      -client-detail
        -documents
          -documents.module.ts (DocumentsPageModule)
          -documents.ts

DocumentsPageModule - тот, который не может быть найден.

const routes: Routes = [
  {
    path: "",
    component: DocumentsPage
  }
]

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    PipesModule,
    MomentModule,
    SharedModule,
    RouterModule.forChild(routes)
  ],
  entryComponents: [
    ShowDocumentModal,
    NewDocumentModal
  ],
  declarations: [
    DocumentsPage,
    NewDocumentModal,
    ShowDocumentModal
  ],
  providers: [
  ],
  exports: [
    RouterModule
  ]
})
export class DocumentsPageModule {}

Этот DocumentsPageModule лениво загружается в ClientsRoutingModule

ClientsRoutingModule

const clientsRoutes: Routes = [
  {
    path: 'clients',
    component: ClientIndexPage,
    canActivate: [AuthGuard],
  }, {
    path: "clients/invite",
    loadChildren: "./client-invite/client-invite.module#ClientInviteModule",
  },
  { path: 'clients/:id',
    component: ClientDetailPage,
    canActivate: [AuthGuard],
    canActivateChild: [AuthGuard],
    children: [
      {
        path: 'profile',
        component: ProfilePage
      },
      {
        path: 'weigh-ins',
        loadChildren: "./client-detail/finance/client-finance.module#ClientFinancePageModule"
      },
      {
        path: 'finance',
        loadChildren: "./client-detail/finance/client-finance.module#ClientFinancePageModule"
      },
      {
        path: 'images',
        loadChildren: "./client-detail/finance/client-finance.module#ClientFinancePageModule"
      },
      {
        path: 'documents',
        loadChildren: "./client-detail/documents/documents.module#DocumentsPageModule"
      },
      {
        path: 'food-orders',
        loadChildren: "./client-detail/finance/client-finance.module#ClientFinancePageModule"
      },
      {
        path: '',
        redirectTo: 'profile',
        pathMatch: 'full'
      }
    ]
  },
];

@NgModule({
  imports: [
    RouterModule.forChild(clientsRoutes),
  ],
  providers: [
  ],
  exports: [RouterModule]
})
export class ClientsRoutingModule { }

По какой-то причине я получаю ошибку : Error: Cannot find 'DocumentsPageModule' in './client-detail/documents/documents.module'. Мой ClientFinancePageModule загружается таким же образом и обнаруживается без проблем.

Что мне здесь не хватает? Если есть проблема с одним из declarations или entryComponents в DocumentsPageModule, помешает ли это загрузиться?

...