How to configure environment variables with vue-cli 3? How to configure environment variables with vue-cli 3? vue.js vue.js

How to configure environment variables with vue-cli 3?


it just happened to me, the solution is very simple. Just restart your development server.

ctrl + c

then

npm run serve


There might be different ways to achieve this, one easy way from command line would be:

npx vue-cli-service serve --mode production

Default to development if mode was not specified.


You need to rename the file to .env only instead of .env.production or .env.development. it should work, if not, comment on the same thread.