Nuxt Auto-Import and Modules Overview
Explore JavaScript modules and the relevant syntax along with Nuxt auto-import.
We'll cover the following...
We'll cover the following...
Nuxt adds a layer of convenience to a Vue.js app called auto-imports. When using multiple files (modules) in a project, we often need to use files inside other files. Typically, we export the contents of a file that we import into other files. Here are some examples:
Default exports
In Vue.js, this is how a default example looks:
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
Example of a Vue.js application importing and exporting
Inside the components/HelloWorld.vue file, there is a script. Inside this, we use export default to export a single value, which is an object containing information about this component. It is also worth noting a file/module like this can only have one default ...