Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between tsconfig.json and tsconfig.app.json files in Angular

I'm a newbie in Angular. I used angular-cli to learn about angular and I found the files tsconfig.json and tsconfig.app.json. Both of these are typescript related and I found this link useful.

But why two such files has been used? Why can't the configurations in these two files be combined in one file? Please help me figure this out.

like image 797
kmg Avatar asked Feb 27 '19 04:02

kmg


People also ask

What is Tsconfig json file?

The tsconfig. json file specifies the root files and the compiler options required to compile the project. JavaScript projects can use a jsconfig. json file instead, which acts almost the same but has some JavaScript-related compiler flags enabled by default.

Where is the Tsconfig json file?

The tsconfig. json is generally put in the root folder of the project.

Which of the following is correct about Tsconfig json?

Correct Answer : Option (C) : This file is used to give the options about TypeScript used for the Angular JS project.


1 Answers

there is nothing that prevents you from getting rid of the tsconfig.app.json. it's just an additional config file that allows you to adjust your configuration on an app basis. this is e.g. useful when you have multiple apps in the same angular-cli workspace.

you could have the root folder with the tsconfig.json and then a sub folder app-a with a tsconfig.app.json file and another app in the sub-folder app-b with it's own tsconfig.app.json, which contains a variation of the global configuration.

the difference in configuration could e.g. be the output directory outDir or the includes or excludes used.

like image 190
jahller Avatar answered Sep 24 '22 22:09

jahller