To enable create react app to run in SSL mode, we need to set HTTPS=true in the package.json like this
"start": "HTTPS=true react-scripts start",
However, I would like this only in production and not when development happens locally. I have a .env file, and would like to use a flag REACT_APP_USE_SSL=true
in production and then REACT_APP_USE_SSL=false
locally.
My question is, how can I use this environment variable in package.json? Or is there another way to seamlessly switch between HTTP and HTTPS mode for development and production environment?