I have simple fix. Put this code in main.ts
if(env === 'prod') { // assuming you have env variable configured
// check if window exists, if you render backend window will not be available
if(window){
window.console.log = function(){};
}
}