Question · Vue.js course · Module 12: Testing & Deploy
Environment variables in Vite
How do you properly add an environment variable accessible in Vue code with Vite?
Answer options
- An .env file with the VITE_ prefix, accessed via import.meta.env.VITE_NAME
- An .env file with the VUE_APP_ prefix, accessed via process.env.VUE_APP_NAME
- A config.js file with arbitrary variable names
- Environment variables are not supported in Vite
You can check the correct answer by solving this task in the CodeWorlds game.