@nuxt/docs-nightly 4.3.0-29458913.b0ea8b60 → 4.3.0-29458918.2df4e1ae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -148,13 +148,30 @@ export default defineNuxtModule({
|
|
|
148
148
|
|
|
149
149
|
addImports({
|
|
150
150
|
name: 'useComposable', // name of the composable to be used
|
|
151
|
-
as: '
|
|
151
|
+
as: 'useMyComposable', // optional alias that will be available for the consuming apps
|
|
152
152
|
from: resolver.resolve('runtime/composables/useComposable'), // path of composable
|
|
153
153
|
})
|
|
154
154
|
},
|
|
155
155
|
})
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
Multiple entries can be passed as an array:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
import { addImports, createResolver, defineNuxtModule } from '@nuxt/kit'
|
|
162
|
+
|
|
163
|
+
export default defineNuxtModule({
|
|
164
|
+
setup (options, nuxt) {
|
|
165
|
+
const resolver = createResolver(import.meta.url)
|
|
166
|
+
|
|
167
|
+
addImports([
|
|
168
|
+
{ name: 'useFirstComposable', from: resolver.resolve('runtime/composables/useFirstComposable') },
|
|
169
|
+
{ name: 'useSecondComposable', from: resolver.resolve('runtime/composables/useSecondComposable') },
|
|
170
|
+
])
|
|
171
|
+
},
|
|
172
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
158
175
|
Alternatively, you can add an entire directory by using `addImportsDir`.
|
|
159
176
|
|
|
160
177
|
```ts
|