Checked an old project. First commit on 8th March 2021 has this code.
This is not new. Has always been like this.
And I haven't seen any problem ever regarding ENV variables because of this condition.
This is only a problem when you're using a .env file to define environment variables. Variables defined in the Wappler editor or injected by Docker/Caprover/etc. are not affected.
It's standard practice to use a .env file in production (before Docker and before Wappler editor added environment variables), so the condition doesn't make sense
For example in the PHP framework Laravel. You would upload your files through FTP to your shared hosting and create a .env file to contain your environment variables, and the PHP script would load them
In Wappler NodeJS I ran into this issue when using PM2 for deployment, it wasn't reading the .env file
As for the environment variables, dotenv is really only meant for local development target only. You should just define your environment variables in the server connection options per target.
You say dotenv is only for development like it's a best practice, yet you store environment variables in a JSON file not excluded in .gitignore, against best practices...
That dotenv condition to only run in development doesn't make sense to people like me, JonL, tbvgl and similar. The only possible problem here is if somewhere along Wappler life you forgot to ignore .env files from being uploaded in deployments, so if you were to remove that condition and people had a .env file uploaded it could mess things up.