在角度 9 中找不到模块“./modules/shipper/shipper.module”?

Cannot find module './modules/shipper/shipper.module' in angular9?

我有一个 angular 应用程序,我在其中进行延迟加载。我的文件夹结构是这样的

app
 modules
   shipper
     addshipper
     shipper
     shipper.module.ts
     shipper.routing.module.ts
   transporter
app.routing.module.ts
app.module.ts

在我的 app-routing.module.ts 我有 lazyload 我的 shipper module 像这样

{ path: 'addshipper', loadChildren : './modules/shipper/shipper.module#ShipperModule'}

在我的 shipper.module.ts 中我有关注

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AddshipperComponent } from './addshipper/addshipper.component';
import { ShipperRoutingModule } from './shipper-routing.module';

export const options: Partial<IConfig> | (() => Partial<IConfig>) = null;
@NgModule({
    declarations: [
        AddshipperComponent
    ],
    imports: [
        BrowserModule,
        ShipperRoutingModule
    ],
    providers: []
})
export class ShipperModule { }

在我的 shipper.module.ts 里面,我关注 child routes

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@app/authguard.guard';
import { AddshipperComponent } from './addshipper/addshipper.component';
const routes: Routes = [
  {
      path: '',
      children: [
        { path: '', component: AddshipperComponent,canActivate: [AuthGuard] } 
      ]
  }
];

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

在我的应用程序的 side nave 中,我有这样的 link

<a  routerLink="/addshipper" class="nav-link">
   <i class="fa fa-circle nav-icon"></i>
   <p>Add Shipper</p>
</a>

但问题是当我点击 Add Shipper link 所以我在 console

中得到了这个 error
Uncaught (in promise): Error: Cannot find module './modules/shipper/shipper.module'

我认为您需要在 shipper.module.ts

中导入 CommonModule
imports: [CommonModule,
 BrowserModule, ShipperRoutingModule ],

并且您需要导出 public 组件

exports:[AddshipperComponent]