I build my production version of Vue client using webpack, and inside of my Vue code, I use some environment variables. The problem is that when it is building no env vars are set.
I tried following stuff.
new webpack.DefinePlugin({
'process.env' : {
MYVAR : JSON.stringify(process.env.MYVAR)
}
})
However, since when it is being built, env var is not yet provided (it will be provided during the run time) and they become just undefined.
What I'd like to do is accessing env vars during run time, not setting them up when it is being built.
Summary: Assuming that I build it with webpack, is there any way I can use environment variables that is provided when the server starts to run, not when it is built?
Any advice would be appriciated! Thanks!