Skip to content

Commit

Permalink
fix: optional components and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
modbender authored and modbender committed Dec 12, 2023
1 parent 7728aa7 commit 1b5a44a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export default defineNuxtModule<ModuleOptions>({

if (!!options.lowlight && options.lowlight !== false) {
optionalImports = [...optionalImports, ...allImports.lowlightImports];
} else {
optionalImports = [...optionalImports, ...allImports.defaultCodeImports];
}

optionalComponents = [...optionalComponents];
Expand All @@ -101,6 +99,17 @@ export default defineNuxtModule<ModuleOptions>({
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,
Expand Down

0 comments on commit 1b5a44a

Please sign in to comment.