From 1b5a44aef656fb1ba1517e5ccde08e4b38c328ec Mon Sep 17 00:00:00 2001 From: modbender <{ID}+{username}@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:19:29 +0530 Subject: [PATCH] fix: optional components and imports --- src/module.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/module.ts b/src/module.ts index d2304cc..986a2fc 100644 --- a/src/module.ts +++ b/src/module.ts @@ -85,8 +85,6 @@ export default defineNuxtModule({ if (!!options.lowlight && options.lowlight !== false) { optionalImports = [...optionalImports, ...allImports.lowlightImports]; - } else { - optionalImports = [...optionalImports, ...allImports.defaultCodeImports]; } optionalComponents = [...optionalComponents]; @@ -101,6 +99,17 @@ export default defineNuxtModule({ transpileModules.add(obj.path); } + for (const obj of optionalComponents) { + addComponent({ + mode: "client", + name: `${options.prefix}${obj.name}`, + export: obj.name, + filePath: obj.path, + // _internal_install: obj.path, + }); + transpileModules.add(obj.path); + } + nuxt.options.build.transpile = [ ...nuxt.options.build.transpile, ...transpileModules,