I have a settings.js file that only contains definitions :
export default {
maintenanceMode: 'yeahhhhh',
enableRegister: false,
}
In order to make these settings available from everywhere in my app with this.$maintenanceMode for example, I added this, which works perfectly, to my main.js :
Vue.prototype.$maintenanceMode = globalSettings.maintenanceMode
Vue.prototype.$enableRegister = globalSettings.enableRegister
But when I try to assign values dynamically like this in my main.js :
for (const [key, value] of Object.entries(globalSettings)) {
Vue.prototype['$' + key] = globalSettings[value]
})
}
or like this :
for (const [key, value] of Object.entries(globalSettings)) {
Object.defineProperty(Vue.prototype, '$' + key, {
value: globalSettings[value],
})
}
this.$maintenanceMode is undefined...
Does anyone has already done something similar or can point me where is my error ?