Search code examples
angulartypescripttsconfig

What happens to the outDir in tsconfig.json for Angular projects?


I have added Angular to my Node Express app in VS Code. I did this through Angular CLI's ng new.

In tsconfig.json, outDir points to ./dist/out-tsc. There is another outDir in angular-cli.json.

When I run ng build, Javascript files are generated in the outDir indicated in angular-cli.json. What is the outDir in tsconfig.json for? The folder ./dist/out-tsc was not created.


Solution

  • What is the outDir in tsconfig.json for?

    Nothing if using AngularCLI. The angular.json (.angular-cli.json prior to Angular 6) file controls the output configuration.

    As indicated by:

    The folder ./dist/out-tsc was not created.

    If you use VS Code file watchers to compile your TS files on the fly/on request, then the tsconf.json file location will be used (depending on VSCode config of course). You can probably surmise that using one method or the other is a good idea. You may run into versioning difficulty if you use a combination of both methods.

    Stick to the CLI.