diff --git a/MlArror.vue b/MlArror.vue deleted file mode 100644 index 4ac1c52..0000000 --- a/MlArror.vue +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/index.js b/index.js new file mode 100644 index 0000000..31bb0dd --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +import MyModule from './modules/module'; + +export default MyModule; \ No newline at end of file diff --git a/modules/module.ts b/modules/module.ts new file mode 100644 index 0000000..6d1b90e --- /dev/null +++ b/modules/module.ts @@ -0,0 +1,23 @@ +// modules/my-module.ts +import { + defineNuxtModule, + createResolver, + addComponentsDir, +} from "@nuxt/kit"; + +export interface ModuleOptions {} + +export default defineNuxtModule({ + meta: { + name: "module", + configKey: "myModule", + }, + defaults: {}, + setup(_options, _nuxt) { + const resolver = createResolver(import.meta.url); + + addComponentsDir({ + path: resolver.resolve("src/components/Ml"), + }); + }, +}); diff --git a/nuxt.config.ts b/nuxt.config.ts index f79a2e1..4b05efa 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,6 +1,6 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ - modules: ["@nuxtjs/tailwindcss", "@nuxtjs/color-mode"], + modules: ["@nuxtjs/tailwindcss", "@nuxtjs/color-mode", "~/modules/module"], compatibilityDate: "2024-04-03", devtools: { enabled: true }, colorMode: {}, diff --git a/package.json b/package.json index d0e2d45..abda3ef 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,14 @@ { "name": "nuxt3-reusable-components", - "version": "1.1.4", + "version": "1.1.7", "private": false, "type": "module", - "main": "module.ts", + "main": "index.js", "scripts": { "build": "nuxt build", + "prepack": "nuxt build", "dev": "nuxt dev", - "generate": "nuxt generate", - "preview": "nuxt preview", - "postinstall": "nuxt prepare" + "start": "nuxt start" }, "dependencies": { "@heroicons/vue": "^2.1.4", diff --git a/src/module.ts b/src/module.ts deleted file mode 100644 index 836fceb..0000000 --- a/src/module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineNuxtModule, addComponentsDir } from '@nuxt/kit' - -export default defineNuxtModule({ - setup(options, nuxt) { - addComponentsDir({ - path: '~/components/Ml', - }) - } -}) \ No newline at end of file