Remove console.log during Angular 6.x library compilation

Viewed 927

I have an Angular 6.x library project and compiling the library with --prod does not remove calls to console.log. Is there a parameter that will remove all console.log calls during compilation?

2 Answers

in main.ts file add this

f(your_env === 'prod') { 
   window.console.log = function(){};
}  

a simple fix would be

if (environment.production) {
      enableProdMode();
      if(window){
        window.console.log=function(){};
      }
    }
Related