Page 44 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis recommends a doctor-up of the default ASP.NET Core 2 Angular project's tsconfig.json file which looks like so:
{
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"target": "es5",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"strict": true,
"lib": [ "es6", "dom" ],
"types": [ "webpack-env" ]
},
"exclude": [ "bin", "node_modules" ],
"atom": { "rewriteTsconfig": false }
}
...like this!
{
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"target": "es5",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"strict": true,
"lib": [ "es6", "dom" ],
"types": [ "webpack-env" ]
},
"exclude": [ "bin", "node_modules" ],
"atom": { "rewriteTsconfig": false },
"angularCompilerOptions": {
"strictMetadataEmit": true
}
}
With this change the Angular AoT (ahead of time) compiler, not to be confused with TSC (the TypeScript Compiler), will let you know about markup errors before you navigate to the component where the problem is. Without this turned on, the errors are just logged somewhere. I messed around with this some today and could not see a difference between having the setting and not having it honestly.
No comments:
Post a Comment