0👍
You could set it in an environment variable during the build and access it via process.env.MY_VARIABLE
.
During development you would use a package like https://www.npmjs.com/package/dotenv and have a .env
file with your environment variables but in production you would set it in your CI or build script.
Bare in mind if this is browser based then you will need to replace
process.env
references with the explicit values which you can do with most bundlers.
- [Vuejs]-"Cannot GET" error in REST API using Vue.js
- [Vuejs]-Sending multiple files to Laravel backed using Vue.js
Source:stackexchange.com