1

I'm using @vue/cli 4.2.3 but when I create a .env file in my project root folder and declared a new env variable in it then print it in any component it returns undefined. My env variable is like VUE_APP_NAME=VALUE and I'm calling it like console.log(process.env.VUE_APP_NAME) and the result is always undefined Any help, pls?

  • Does this answer your question? [Vue-cli 3 Environment Variables all undefined](https://stackoverflow.com/questions/55510326/vue-cli-3-environment-variables-all-undefined) – Salim Mahboubi Mar 01 '21 at 17:33

1 Answers1

1

With the information you give it seems that you are doing well.

  1. The file is in the root.
  2. The variable starts by VUE_APP_

I would check that the .env file has no extension.

Vallemar
  • 193
  • 2
  • 7