Is there any way to use some kind of DEBUG directive in JS code causing debug code not to be included in production? Examples:
// #if debug
console.log('Initializing');
// #endif
var url =
// #if debug
'/foo/debug';
// #else
'/foo';
// #endif
No. But you can simply replace
console.logwith a dummy function for production:Then you just need to configure your build tools (assuming you have some) to include that code only in production builds.