AkiZukiLenn
AkiZukiLenn

Reputation: 398

Will angular remove typescript or html comment during the compilation process?

Angular compile typescript and turn them into javascript with the use of ng serve command. My question is, does it default remove all comment inside html files, typescript. Or else you have ability to do this by setting the option in file like angular.json?

Upvotes: 0

Views: 1379

Answers (1)

Yaroslav
Yaroslav

Reputation: 378

By default, comments are not deleted. If you want to delete comments from Html file you just need to build your app in production mode: ng build --prod.

If you want to delete comments from *.ts files you need to set removeComments in your tsconfig.json file (https://www.typescriptlang.org/tsconfig#removeComments) like this:

{
    "compilerOptions": {
        "removeComments": true,
        ...
    },
    ...
}

Upvotes: 2

Related Questions