【问题标题】:Warning Upgrade the Angular 7 to 9 get warning警告 将 Angular 7 升级到 9 会收到警告
【发布时间】:2020-06-09 00:56:09
【问题描述】:

在 npm start 发出警告后更新我的项目中的 Angular 版本

WARNING in E:\bansi\project\BTT\BTT_new - angular 9.0.1\BTTReport_AspnetZero_New\BTTCorpAngular-master\src\app\btt-report\monthly-report\monthly-report.component.spec.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig. 并且在构建我的项目时会出现很多错误。我厌倦了更改依赖添加和删除。

我添加了 tsconfig.app.json 文件

{
  "extends": "./tsconfig.json",
    "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
  "src/main.ts",
  "src/polyfills.ts"
],
 "include": [
 "src/**/*.ts"
],
   "exclude": [
   "src/test.ts",
   "src/**/*.spec.ts"
  ]
}

【问题讨论】:

  • 警告是由于 lint 配置。下面的讨论可能会有所帮助。 stackoverflow.com/questions/47778839/….
  • @LaminooLawrance 它已经添加了它不起作用。
  • @Bansi29 你能删除 src 吗?然后再试一次? == "*/.spec.ts",像这样
  • 嗨,@Energy 感谢您的回复,但是,它收到了report\monthly-report.component.spec.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig.的警告

标签: angular angular9


【解决方案1】:

这里提到:How to get rid of the warning .ts file is part of the TypeScript compilation but it's unused

从包含数组中删除 "src/**/*.ts" 就可以了。

或者你可以在tsconfig.app.json的排除数组中添加未使用的文件

【讨论】:

    猜你喜欢
    • 2020-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-12
    • 2011-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多