Angular8升級至Angular10報 .ts file is part of the TypeScript compilation but it‘s unused 的warning

這幾天升級公司的一個Angular項目,把Angular更新到最新的10.0.1版本。

"dependencies": {
  "@angular/animations": "^10.0.1",
  "@angular/cdk": "^10.0.1",
  "@angular/common": "~10.0.1",
  "@angular/compiler": "~10.0.1",
  "@angular/core": "~10.0.1",
  "@angular/forms": "~10.0.1",
  ...
},
"devDependencies": {
  "@angular-devkit/build-angular": "~0.1000.0",
  "@angular-devkit/core": "^10.0.0",
  "@angular/cli": "~10.0.0",
  "@angular/compiler-cli": "~10.0.1",
  "@angular/language-service": "~10.0.1",
  ...
}

更新運行後,一直看到這個警告。警告

XXX.ts file is part of the TypeScript compilation but it’s unused

解決辦法:
找到tsconfig.app ts文件,刪除"include":["src/**/*.ts"]這一行,只在文件中保留入口點(main.tspolyfills.ts)
tsconfig.app.json

參考:how-to-get-rid-of-the-warning-ts-file-is-part-of-the-typescript-compilation-but

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章