DEV Community

Discussion on: Hide 🙈 all console logs in production with just 3 lines of code

Collapse
 
mikaelgramont profile image
Mikael Gramont

That is one way to do it, and it certainly is simple. However, you're still shipping the code that makes those calls in the first place.

To address that, one could take advantage of the bundling process to strip out all those calls in the first place. For example, it looks like UglifyJS supports conditional compiling that will help with that.