ng build --prod无法确定X类的模块!将ThreadListTabsComponent添加到NgModule以修复它

时间:2018-04-28 01:31:07

标签: angular typescript angular-cli tsconfig

我正在尝试构建我的Angular 5应用,并且我收到错误:

  

无法确定类ThreadListTabsComponent的模块   /home/brightwater/Differ/src/app/thread-lists/thread-lists.component.ts!   将ThreadListTabsComponent添加到NgModule以修复它。

这很令人困惑,因为我在模块中导入有问题的组件:

线程lists.module.ts

import { OtherModules } from './modules-everywhere';
import { NgModule }      from '@angular/core'

import { SomeOtherComponents }  from './other-components.component';
import { ThreadListTabsComponent } from './thread-list-tabs.component';

@NgModule({
  imports: 
  [ 
    OtherModules
  ],
  declarations: [
    OtherComponents,
    ThreadListTabsComponent
  ],
  exports: [
    OtherComponents,
    ThreadListTabsComponent
  ],
  providers: [ ThreadListsService ]
})


export class ThreadListsModule { }

这是组件:

线程列表tabs.component.ts

import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Router }   from '@angular/router';
import { ThreadListsService }   from './thread-lists.service';

@Component({
  moduleId: module.id,
  selector: 'thread-list-tabs',
  templateUrl: 'thread-list-tabs.component.html',
  styleUrls: ['thread-list-tabs.component.css']
})


export class ThreadListTabsComponent {

  // Stuff this component does

}

app.module.ts

import { NgModule } from '@angular/core'
import { ThreadListsModule } from './thread-lists/thread-lists.module'
import { OtherModules } from './other.modules'
import { AppComponent } from './app.component'

@NgModule({
  imports: [    
    OtherModules, 
    ThreadListsModule
  ],
  declarations: [ 
    AppComponent
  ],
  providers: [ SomeService ],
  bootstrap: [ AppComponent ]
})

export class AppModule { }

我有什么遗失的吗?

1 个答案:

答案 0 :(得分:7)

这看起来像文件名大小写问题。见github.com/angular/angular-cli/issues/10732