feat(nuxt): support vue directive auto-imports within unimport (#29818)

This commit is contained in:
Joaquín Sánchez 2024-12-03 14:16:44 +01:00 committed by GitHub
parent a01c41b4d3
commit 474832f653
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,13 +41,19 @@ export default defineNuxtModule<Partial<ImportsOptions>>({
// Filter disabled sources
// options.sources = options.sources.filter(source => source.disabled !== true)
const { addons: inlineAddons, ...rest } = options
const [addons, addonsOptions] = Array.isArray(inlineAddons) ? [inlineAddons] : [[], inlineAddons]
// Create a context to share state between module internals
const ctx = createUnimport({
injectAtEnd: true,
...options,
...rest,
addons: {
addons,
vueTemplate: options.autoImport,
...options.addons,
vueDirectives: options.autoImport === false ? undefined : true,
...addonsOptions,
},
presets,
})