I'd like to hear a technical explanation as to how the .env file manages to inject the correct string for using API keys on the frontend without actually being visible to the browser. It's my understanding that process.env
is injected into the JS at runtime, but shouldn't that mean the variables are just as accessible as they would be if they were loaded into your main.js
bundle?
I'm just perplexed as to how a secret is actually still a secret while allowing the browser to access and use the API key.