Currently, I am developing a React App within an npm environment.
Throughout my JavaScript code, I have the following snippet in multiple JS files:
...
let url = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "") + "/" + baseUrl;
if (DEBUG) {
url = "http://myTestPlatform.com/webapp";
}
...
During the development stage of my WebApp (using npm start), I need the debug code to be active. However, when generating the production build (using npm build), I want all debugging code to be removed.
Any suggestions on how I can achieve this would be greatly appreciated!
Thank you,
Sebastien