From 25230ed381c5fafa760a86443ef235424743c1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Tue, 3 Dec 2024 14:16:44 +0100 Subject: [PATCH] feat(nuxt): support vue directive auto-imports within unimport (#29818) --- packages/nuxt/src/imports/module.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/imports/module.ts b/packages/nuxt/src/imports/module.ts index 1b9e698203..5465a180e2 100644 --- a/packages/nuxt/src/imports/module.ts +++ b/packages/nuxt/src/imports/module.ts @@ -41,13 +41,19 @@ export default defineNuxtModule>({ // 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, })