Skip to content

Commit

Permalink
added addComponentsDir example to modules author guide
Browse files Browse the repository at this point in the history
  • Loading branch information
pmnzt committed Dec 23, 2023
1 parent 4dcc48f commit b58ff68
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/2.guide/3.going-further/3.modules.md
Expand Up @@ -335,6 +335,22 @@ export default defineNuxtModule({
})
```
Alternatively, you can add an entire directory by using `addComponentsDir`.
```ts
import { defineNuxtModule, addComponentsDir } from '@nuxt/kit'

export default defineNuxtModule({
setup(options, nuxt) {
const resolver = createResolver(import.meta.url)

addComponentsDir({
path: resolver.resolve('runtime/components')
})
}
})
```
#### Injecting Composables With `addImports` and `addImportsDir`
If your module should provide composables, you can use the `addImports` utility to add them as auto-imports for Nuxt to resolve.
Expand Down

0 comments on commit b58ff68

Please sign in to comment.