Yes, this should work in production. If you are using multiple configurations (e.g. for staging and production, etc), check that you have a respective .env file configured for each (after switching what config you are using the config commands) and that you have added your custom values to it. Once you add them to each, it should work.
For example, if you have a staging config like shopify.app.appname-staging then your env file name might look like .env.appname-staging after running the env pull command.
shopify app env pull
https://shopify.dev/docs/api/shopify-cli/app/app-config-use
https://shopify.dev/docs/api/shopify-cli/app/app-env-pull
Hope this helps anyone else who is seeing the process undefined errors in the browser console.