Question: I need access to my `hostname` variable in every component.

Is it a good idea to put it inside `data`?

Am I right in understanding that if I do so, I will able to call it everywhere with `this.hostname`?

Answer: 
As you need access to your hostname variable in every component, and to change it to localhost while in development mode, or to production hostname when in production mode, you can define this variable in the prototype.

Like this:

```
Vue.prototype.$hostname = 'http://localhost:3000'

```

And $hostname will be available in all Vue instances:

```
new Vue({
  beforeCreate: function () {
    console.log(this.$hostname)
  }
})

```

In my case, to automatically change from development to production, I've defined the $hostname prototype according to a Vue production tip variable in the file where I instantiated the Vue.

Like this:

```
Vue.config.productionTip = false
Vue.prototype.$hostname = (Vue.config.productionTip) ? 'https://hostname' : 'http://localhost:3000'

```

An example can be found in the docs:
[Documentation on Adding Instance Properties](https://v2.vuejs.org/v2/cookbook/adding-instance-properties.html#Simple-Example)

More about production tip config can be found here:

[Vue documentation for production tip](https://v2.vuejs.org/v2/api/#productionTip)
I strongly recommend taking a look at [Vuex](https://vuex.vuejs.org/guide/), it is made for globally accessible data in Vue.

If you only need a few base variables that will never be modified, I would use ES6 imports:

```
// config.js
export default {
   hostname: 'myhostname'
}

// .vue file
import config from 'config.js'

console.log(config.hostname)

```

You could also import a `json` file in the same way, which can be edited by people without code knowledge or imported into SASS.