[Vuejs]-How to set an api path during the build process of a vue application based on environment variable?

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.

Leave a comment