add some files

This commit is contained in:
Arina Yakovenko 2024-07-08 11:15:33 +02:00
parent accb3a105d
commit a367b12150
6 changed files with 31 additions and 21 deletions

View File

@ -1,6 +0,0 @@
<template>
<h1>Hello Nuxt3</h1>
</template>
<script setup lang="ts">
</script>

3
index.js Normal file
View File

@ -0,0 +1,3 @@
import MyModule from './modules/module';
export default MyModule;

23
modules/module.ts Normal file
View File

@ -0,0 +1,23 @@
// modules/my-module.ts
import {
defineNuxtModule,
createResolver,
addComponentsDir,
} from "@nuxt/kit";
export interface ModuleOptions {}
export default defineNuxtModule<ModuleOptions>({
meta: {
name: "module",
configKey: "myModule",
},
defaults: {},
setup(_options, _nuxt) {
const resolver = createResolver(import.meta.url);
addComponentsDir({
path: resolver.resolve("src/components/Ml"),
});
},
});

View File

@ -1,6 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config // https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: ["@nuxtjs/tailwindcss", "@nuxtjs/color-mode"], modules: ["@nuxtjs/tailwindcss", "@nuxtjs/color-mode", "~/modules/module"],
compatibilityDate: "2024-04-03", compatibilityDate: "2024-04-03",
devtools: { enabled: true }, devtools: { enabled: true },
colorMode: {}, colorMode: {},

View File

@ -1,15 +1,14 @@
{ {
"name": "nuxt3-reusable-components", "name": "nuxt3-reusable-components",
"version": "1.1.4", "version": "1.1.7",
"private": false, "private": false,
"type": "module", "type": "module",
"main": "module.ts", "main": "index.js",
"scripts": { "scripts": {
"build": "nuxt build", "build": "nuxt build",
"prepack": "nuxt build",
"dev": "nuxt dev", "dev": "nuxt dev",
"generate": "nuxt generate", "start": "nuxt start"
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
}, },
"dependencies": { "dependencies": {
"@heroicons/vue": "^2.1.4", "@heroicons/vue": "^2.1.4",

View File

@ -1,9 +0,0 @@
import { defineNuxtModule, addComponentsDir } from '@nuxt/kit'
export default defineNuxtModule({
setup(options, nuxt) {
addComponentsDir({
path: '~/components/Ml',
})
}
})