The modules option is used to add Nuxt modules to your project. For example, take the following:
// nuxt.config.js
export default {
modules: [
'@nuxtjs/axios',
'~/modules/example.js'
]
}
We also can create inline modules directly with this option:
// nuxt.config.js
export default {
modules: [
function () {
//...
}
]
}
Nuxt modules are essentially JavaScript functions, just like plugins. We will discuss the difference between them in Chapter 6, Writing Plugins and Modules. Just like the plugins option, which is used often with the /plugins/ directory, the modules option is often used with the /modules/ directory. We will work on this option often in Chapter 6, Writing Plugins and Modules.