I'm trying to add some environment variables into my vue app.
here is content of my .env
file, which is placed on root(outside src
):
VUE_APP_GOODREADS_KEY = my_key
and I added code for dot env on the top of my main.js
import Vue from 'vue'
import App from './App'
import VueResource from 'vue-resource'
import Vuetify from 'vuetify'
import dotenv from 'dotenv'
dotenv.config()
import { router } from './router'
import store from './store'
I want to use this variable within my store ./store/index.js
I tried to console.log environment variables within store but no luck:
console.log(process.env)
But all I'm getting is
NODE_ENV:"development"
Only related thread I found was Load environment variables into vue.js, but it only mentions how to use existing variables in the process.env
. I want to add environment variables using dotenv. Why this code is not working?