I'm currently working on a project using VueCLI version 3.0
. I've created a configuration file at the root named vue.config.js
where my custom configurations are defined. However, I find myself having to load this file in every component
file in order to use it. Is there a way or option to make this configuration accessible globally in every js
file and component
?
As a newcomer to VueCLI, I would appreciate any guidance.
Below is the content of my vue.config.js
file:
// vue.config.js
module.exports = {
api : {
server: 'http//:192.168.0.1'
}
}
In my App.vue
, I aim to access the configuration settings like this:
<script>
export default{
mounted(){
console.log(api.server)
}
}
</script>
If anyone could offer assistance or suggestions, it would be greatly appreciated.