这几天升级公司的一个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.ts
和polyfills.ts
)
参考:how-to-get-rid-of-the-warning-ts-file-is-part-of-the-typescript-compilation-but