Unable to lazy load feature module in Angular

553 views Asked by At

I'm following the documentation on lazy loading and I get the following error on an Angular 10 project

ERROR in src/app/modules/app-routing.module.ts:21:52 - error TS2339: Property 'MergeModule' does not exist on type 'typeof import("C:/.../src/app/modules/merge/merge.module")'.

I got the following in my routes

{
  path: 'merge',
  loadChildren: () =>
    import('./merge/merge.module').then((m) => m.MergeModule)
}

the rest are pretty empty

import { NgModule } from '@angular/core';
import CommonModule from '../shared.module';
import MergeRoutingModule from './merge-routing.module';
import MergeContainerComponent from './container.component';

@NgModule({
  declarations: [MergeContainerComponent],
  imports: [CommonModule, MergeRoutingModule]
})
export default class MergeModule {}

and the feature routing module is like this

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';    
import MergeContainerComponent from './container.component';

const routes: Routes = [
  {
    path: '',
    component: MergeContainerComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export default class MergeRoutingModule {}
0

There are 0 answers