问题
File 'src/app/app.component.spec.ts' is not part of Typescript project 'src/tsconfig.app.json' while upgrading to Angular 5
We have followed all the instructions for converting our project from angular 4 but are pulling out our hair over this one - anyone have any ideas?
We are getting this error from tslint...
回答1:
Change the "lint" section of .angular-cli.json by replacing all of the "files" entries with "exclude" entries...
"lint": [
{
"project": "src/tsconfig.app.json",
"files": "src/**/*.ts"
},
{
"project": "src/tsconfig.spec.json",
"files": "src/**/*.spec.ts"
},
{
"project": "e2e/tsconfig.e2e.json",
"files": "e2e/**/*.ts"
}]
becomes
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}]
回答2:
Turns out the files specified in our .angular-cli.json for our lint configuration, but we should have been just relying on the files specified in our tsconfig.json files. We removed the files from angular-cli.json and all is well.
来源:https://stackoverflow.com/questions/47778839/file-src-app-app-component-spec-ts-is-not-part-of-typescript-project-while-upg