29 lines
607 B
TypeScript
29 lines
607 B
TypeScript
// modules/my-module.ts
|
|
import { defineNuxtModule, createResolver, addComponent } from "@nuxt/kit";
|
|
|
|
export interface ModuleOptions {}
|
|
|
|
const components = [
|
|
{
|
|
name: "MlButton",
|
|
path: "../src/components/Ml/Button/MlButton.vue",
|
|
},
|
|
];
|
|
export default defineNuxtModule<ModuleOptions>({
|
|
meta: {
|
|
name: "module",
|
|
configKey: "myModule",
|
|
},
|
|
defaults: {},
|
|
setup(_options, _nuxt) {
|
|
const resolver = createResolver(import.meta.url);
|
|
|
|
for (let item of components) {
|
|
addComponent({
|
|
name: item.name,
|
|
filePath: resolver.resolve(item.path),
|
|
});
|
|
}
|
|
},
|
|
});
|