我在 Angular CLI 项目中使用 angular2-logger 版本 0.6.0。当我尝试升级到 Angular CLI 1.5 和 Angular 5 时,出现以下错误
ERROR in ./node_modules/angular2-logger/app/core/level.ts
Module build failed: Error: C:\test\sample-5\sample\node_module\angular2-logger\app\core\level.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\test\sample-5\sample\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:624:23)
at plugin.done.then (C:\test\sample-5\sample\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
@ ./node_modules/angular2-logger/core.js 6:9-36
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
这是 app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { Logger } from 'angular2-logger/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [Logger],
bootstrap: [AppComponent]
})
export class AppModule { }
这个示例项目是由创建的ng new sample
,所以每个设置都是 Angular CLI 默认的。