Vue.js does not have direct access to runtime environment variables because they are baked into the app during the build process. Instead of trying to access process.env in Vue components, a better approach is to dynamically inject environment variables into a config.js file that the app can load at runtime.
Here are the steps I used to resolve this:
config.js
file at runtime instead of embedding
environment variables at build time.config.js
in index.html
so the Vue app can access its values dynamically.window.config
instead of process.env.entrypoint.sh
script to inject environment variables into config.js
before starting the app.I believe this tutorial provides a complete step-by-step guide on implementing this solution effectively: https://www.baeldung.com/ops/vuejs-pass-environment-variables-runtime