[Vuejs]-How to access (build time) config variables client side?

0👍

You can assign its value to data then render it in client-side

<div>{{ NODE_ENV }}</div>


data() {
  return {
    NODE_ENV: process.env.NODE_ENV
  }
}

0👍

vue-config seems to be a good way to handle client side configs and can read config from an endpoint.

https://github.com/airyland/vue-config

from this question
https://stackoverflow.com/a/42549522/1146785

👤dcsan

Leave a comment