Is there a ready to use way to mark some method or function inside my TypeScript code as for development/debug only, so that it doesn't go into production code when compiled with Webpack?
Something like as comments are cut out of the code.
I have some functions I use sometimes to debug the app, but not used in production. I would like to not comment them out for production because someone else in the team can decide to remove this code as outdated when see it commented.
TypeScript does not have a way of doing this out the box, but you can achieve it by using a task runner, such as gulp and using a plugin like this.
I've not really used Webpack before, but I found a plugin that allows you to remove functions from code here.
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