[Vuejs]-.env.production variable undefined after Vue build

0👍

My recommendation is: Do not overcomplicate. Just use one single .env file.

Just make sure to don’t push it to the repo, otherwise it would be public. That’s all.

I my config I’ve got: .env for dev with the constants in there.

Then In the production enviroment you just set the Variables there.

0👍

You should not push .env.production to git repo but if you really want to do it, on build command you can do like this on package.json file

"build": "cp .env.production .env && vue-cli-service build",

Leave a comment