Npm开始坚持70%的加入"懒惰"模块

Aa *_* Yy 9 npm typescript angular

我知道之前有人问过这个问题,但没有任何解决方案可以解决这个问题.我已将此模块添加到现有项目中:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { DashboardComponent } from '../BackOffice/components/dashboard.component';

const routes: Routes = [
  {
    path: '',
    component: DashboardComponent,
    pathMatch: 'full'
  }];

@NgModule({
  imports: [
      CommonModule,
      RouterModule.forChild(routes)
  ],
  declarations: [DashboardComponent]
})
export class LazyModule { }
Run Code Online (Sandbox Code Playgroud)

app.module:

 { path: 'lazy', loadChildren: 'app/lazy/lazy.module#LazyModule' },
Run Code Online (Sandbox Code Playgroud)

从那以后,"npm start"停留在70%: npm开始

如果我删除模块,它建立良好.这是Angular 4 btw.谢谢

Kal*_*ala 2

您正在尝试从名为lazy的目录中获取lazy 模块。

我在这里查看了您的目录结构 但我没有找到任何名为“lazy”的目录。

您的LazyModule类位于哪里?

如果它位于其他目录中,那么您可以在AppModule中执行以下操作

 { path: 'lazy', loadChildren: './<your-deirectory-name>/lazy.module#LazyModule' },
Run Code Online (Sandbox Code Playgroud)