mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
docs: add addComponentsDir
example to modules author guide (#24876)
This commit is contained in:
parent
4dcc48f4e6
commit
14b95e0d4f
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user