Closed suhirthan closed 5 years ago
Vue CLI works like that. https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code
I think you'll need to rename your frontend vars to VUE_APP_*
Thanks, solved. Might have to change the vue.config.js file to match this.
@suhirthan The way the project is set up, you should never actually need access to the API_BASE_URL
in your application code. Would you mind sharing the use case you ran into?
Closing this due to inactivity, but happy to reopen if need be. 🙂
Having the same problem here. Please can anyone help? I need to change the base url its taking by default the localhost:8080 i need to point to some other ref. I am using vue cli 3 used the VUEAPP* reference i could print the variable in the console but the host value is not changing when I call the Api, I updated the vue.config file as well no change.
See publicPath
in the Vue CLI docs:
Having the same problem here. Please can anyone help? I need to change the base url its taking by default the localhost:8080 i need to point to some other ref. I am using vue cli 3 used the VUEAPP* reference i could print the variable in the console but the host value is not changing when I call the Api, I updated the vue.config file as well no change.
Did you manage to solve this issue?
Just as a little heads up, if you add the public path option you also need to set the base in the router to that path or else the routing wont work. Took me some time to figure that one out.
When trying to run yarn dev only Env variable which have the prefix VUE_APP seems to be loading other such as the API_BASE_URL are being ignore when passed as mentioned in the document. Is this something that is a configuration.