The environment variable name used in code must match the name set in the .env
file:
// .env
VITE_API_KEY=abcd1234
👆
// firebase.js
const firebaseConfig = { 👇
apiKey: import.meta.env.VITE_API_KEY,
â‹®
}
demo
Relevant documentation can be found in the Vite Env variables docs