Reputation: 51
Post my upgrade from Angular 9 to Angular 10. ng build --prod throws the Typescript compilation unused warnings:
.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig.
I have tried all solutions like removing the following include directive from tsconfig.app.json:
"include": [
"src/**/*.d.ts"
]
The only workaround that works is setting Ivy to False. But I do not wish to do that and instead want to find the real solution. I did not face it during my upgrade from Angular 8 to 9. Don't know why am bombarded with these warnings when upgrading to 10. Kindly help.
Upvotes: 5
Views: 8821
Reputation: 7692
A long story short I noticed the the problem arose for people with custom web kit settings.
So I
ng update @angular-devkit/build-angular
and the warnings disappeared.
To be honest, I aimed for updating @ngtools/webpack
but copied the wrong text and by serendipity it solved my problem. (for now...)
Upvotes: 4
Reputation: 51
I rolled back and re-upgraded Angular 9 to 10 using automatic migrations. This time my tsconfig got upgraded and I did not see any warnings.
I think fixing the extends would also work: "extends": "./tsconfig.base.json", if you do not wish to re-upgrade.
Upvotes: 0
Reputation: 93
Try changing the file 'tsconfig.app.json' to:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
]
}
Upvotes: 1
Reputation: 405
only include the main file and if needed the polyfill. everything else will be indirectly loaded via references from the main file.
"include": [
"./polyfills.ts",
"./app-main.ts"
],
Upvotes: 0