Ionic 4 选项卡每次重启后都会停止工作 "ionic serve"

Ionic 4 tabs stop working every time after restarting "ionic serve"

问题是每次我修复我的选项卡时,它们都会开始工作,但是如果我重新启动我的服务器,我会收到以下错误

RROR Error: Uncaught (in promise): Error: Cannot find module '../tab1/tab1.module' Error: Cannot find module '../tab1/tab1.module'

我知道的都做了

这是我的标签-routing.module.ts:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { TabsPage } from './tabs.page';

const routes: Routes = [
  {
    path: '',
    component: TabsPage,
    children:[
      {
        path:'tab1',
        children:[
          {
          path:'',
          loadChildren:'../tab1/tab1.module#Tab1PageModule'
        }
        ]
      },
       {
        path:'tab2',
        children:[
          {
          path:'',
          loadChildren:'../tab2/tab2.module#Tab2PageModule'
        }
        ]
      },
       {
        path:'tab3',
        children:[
          {
          path:'',
          loadChildren:'../tab3/tab3.module#Tab3PageModule'
        }
        ]
      },
       {
        path:'tab4',
        children:[
          {
          path:'',
          loadChildren:'../tab4/tab4.module#Tab4PageModule'
        }
        ]
      },
       {
        path:'tab5',
        children:[
          {
          path:'',
          loadChildren:'../tab5/tab5.module#Tab5PageModule'
        }
        ]
      },{
    path:'',
    redirectTo: './tabs/tab1',
    pathMatch:'full'
  }
    ]
  },{
    path:'',
    redirectTo: './tabs/tab1',
    pathMatch:'full'
  }
];

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

尝试更改 loadChildren 路径:

children: [
  {
    path: 'tab1',
    children: [
      {
        path: '',
        loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule)
      }
    ]
  }]

或者 尝试在 tabs.module.ts 中导入 'Tab1PageModule':

import { TabsPage } from './tabs.page';
import {Tab1PageModule} from '../tab1/tab1.module'; <-- Add this line
@NgModule({
  imports: [
    Tab1PageModule <-- Add this line
  ]
})