Tampa
Tampa

Reputation: 78234

Don't show console.logs with ng build -prod --aot

This is how I build my Angular 2 app for production:

ng build -prod --aot

I have a lot of console.log statements. How do I hide those in a production build?

Upvotes: 0

Views: 791

Answers (1)

sheplu
sheplu

Reputation: 2975

Remove all console.log inside your code ? It's a bad thing to keep your console log after you finish a function

simple fix. but 'bad fix'. Put this code in main.ts

if(env === 'prod') { // assuming you have env variable configured
   window.console.log = function(){};
}  

Upvotes: 1

Related Questions