I want to have different modes for my application, so I created different .env files to store my environment variables. Using these variables works fine, the only problem is that I have to restart the whole application when I change something inside the .env files.
I tried outsourcing the environment variables into a .json file to get it working with Hot Reload, which didn't work.
This is my .env file:
NODE_ENV=development
VUE_APP_JSON_FILE=./m.json
My vue.config.js:
const webpack = require("webpack");
module.exports = {
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
VUE_APP_JSON: JSON.stringify(require(process.env.VUE_APP_JSON_FILE))
})
]
}
My .json file:
{
"logo": {
"picture": "test.jpg",
}
}
Now I can call the variable inside the .json like VUE_APP_JSON.logo.picture.
As I said, all this works, but changing variables in the .env file or the .json file doesn't trigger Hot Reload.
Anyone knows how to achieve that? Thanks in advance.