I have run the following to disable console logs for production environments in my angular application. The below code works as expected for chrome, however, it still shows logs in IE 11.
main.ts
if (environment.production) {
enableProdMode();
if(window){
window.console.log=function(){};
}
}
Is this a polyfill issue? I wasn't able to find anything online about it.
EDIT
This question may seem similar but does not address my issue as to why overriding the console log function to a blank method works in chrome but not IE 11.
Solution is to add the polyfill to your polyfill.ts file
if(!window.console) {
var console = {
log : function(){},
warn : function(){},
error : function(){},
time : function(){},
timeEnd : function(){}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With