nuxtlabs / nuxt-component-meta

Gather Nuxt components metadata on build time and make them available on production.
72 stars 8 forks source link

Component Meta empty error #71

Open sseworld opened 2 months ago

sseworld commented 2 months ago

I have given the code in here. (click here)

My component meta is empty after preparation. Code of component-meta.mjs :-

export default {}

My component-meta.d.ts code is this :-

import type { ComponentData } from 'nuxt-component-meta'
export type NuxtComponentMetaNames = 'ColorModeButton' | 'ComponentCard' | 'ComponentPreset' | 'ComponentProps' | 'ComponentPropsField' | 'ComponentSlots' | 'Placeholder' | 'AsideExample1' | 'Callout' | 'Card' | 'CardGroup' | 'CodeGroup' | 'Collapsible' | 'Field' | 'FieldGroup' | 'Shortcut' | 'Tabs' | 'ProseCode' | 'ProseCodeButton' | 'ProseCodeIcon' | 'ProseH1' | 'ProseH2' | 'ProseH3' | 'ProseH4' | 'ContentDoc' | 'ContentList' | 'ContentNavigation' | 'ContentQuery' | 'ContentRenderer' | 'ContentRendererMarkdown' | 'ContentSlot' | 'DocumentDrivenEmpty' | 'DocumentDrivenNotFound' | 'Markdown' | 'ProseCodeInline' | 'ProsePre' | 'ProseA' | 'ProseBlockquote' | 'ProseEm' | 'ProseH5' | 'ProseH6' | 'ProseHr' | 'ProseImg' | 'ProseLi' | 'ProseOl' | 'ProseP' | 'ProseScript' | 'ProseStrong' | 'ProseTable' | 'ProseTbody' | 'ProseTd' | 'ProseTh' | 'ProseThead' | 'ProseTr' | 'ProseUl' | 'UButton' | 'UIcon' | 'SseIcon' | 'Icon' | 'ColorModeButton' | 'ComponentCard' | 'ComponentPreset' | 'ComponentProps' | 'ComponentPropsField' | 'ComponentSlots' | 'Placeholder' | 'AsideExample1' | 'Callout' | 'Card' | 'CardGroup' | 'CodeGroup' | 'Collapsible' | 'Field' | 'FieldGroup' | 'Shortcut' | 'Tabs' | 'ProseCode' | 'ProseCodeButton' | 'ProseCodeIcon' | 'ProseH1' | 'ProseH2' | 'ProseH3' | 'ProseH4' | 'ContentDoc' | 'ContentList' | 'ContentNavigation' | 'ContentQuery' | 'ContentRenderer' | 'ContentRendererMarkdown' | 'ContentSlot' | 'DocumentDrivenEmpty' | 'DocumentDrivenNotFound' | 'Markdown' | 'ProseCodeInline' | 'ProsePre' | 'ProseA' | 'ProseBlockquote' | 'ProseEm' | 'ProseH5' | 'ProseH6' | 'ProseHr' | 'ProseImg' | 'ProseLi' | 'ProseOl' | 'ProseP' | 'ProseScript' | 'ProseStrong' | 'ProseTable' | 'ProseTbody' | 'ProseTd' | 'ProseTh' | 'ProseThead' | 'ProseTr' | 'ProseUl' | 'UButton' | 'UIcon' | 'SseIcon' | 'Icon'
export type NuxtComponentMeta = Record<NuxtComponentMetaNames, ComponentData>
declare const components: NuxtComponentMeta
export { components as default, components }

My nuxt.config.ts code is this:-

export default defineNuxtConfig({
  modules: [
    "@nuxt/content",
    "@nuxt/eslint",
    "@nuxt/fonts",
    "@nuxt/image",
    "@nuxt/ui",
    "@nuxthq/studio",
    "nuxt-og-image",
    "nuxt-component-meta"
  ],
})

It is showing this error while running

[5:10:08 PM]  ERROR  Cannot start nuxt:  Cannot find module 'D:/next/sse-nuxt-ui/docs/node_modules/nuxt/dist/app/components/welcome'
Require stack:
- D:\next\sse-nuxt-ui\docs\index.js

  Require stack:
  - index.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
  at Function.resolve (node:internal/modules/helpers:133:19)  
  at Function._resolve [as resolve] (node_modules\jiti\dist\jiti.js:1:241814)
  at resolveModule (/D:/next/sse-nuxt-ui/docs/node_modules/@nuxt/kit/dist/index.mjs:2224:29)
  at /D:/next/sse-nuxt-ui/docs/node_modules/nuxt-component-meta/dist/parser.mjs:44:26
  at Array.reduce (<anonymous>)
  at useComponentMetaParser (/D:/next/sse-nuxt-ui/docs/node_modules/nuxt-component-meta/dist/parser.mjs:36:28)
  at /D:/next/sse-nuxt-ui/docs/node_modules/nuxt-component-meta/dist/module.mjs:182:16
  at async /D:/next/sse-nuxt-ui/docs/node_modules/nuxt/dist/index.mjs:2345:7
  at async generateApp (/D:/next/sse-nuxt-ui/docs/node_modules/nuxt/dist/index.mjs:5182:3)
  at async _applyPromised (/D:/next/sse-nuxt-ui/docs/node_modules/perfect-debounce/dist/index.mjs:54:10)

[5:10:08 PM]  ERROR  [unhandledRejection] Cannot find module 'D:/next/sse-nuxt-ui/docs/node_modules/nuxt/dist/app/components/welcome'
Require stack:
- D:\next\sse-nuxt-ui\docs\index.js

  Require stack:
  - index.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
  at Function.resolve (node:internal/modules/helpers:133:19)  
  at Function._resolve [as resolve] (node_modules\jiti\dist\jiti.js:1:241814)
  at resolveModule (/D:/next/sse-nuxt-ui/docs/node_modules/@nuxt/kit/dist/index.mjs:2224:29)
  at /D:/next/sse-nuxt-ui/docs/node_modules/nuxt-component-meta/dist/parser.mjs:44:26
  at Array.reduce (<anonymous>)
  at useComponentMetaParser (/D:/next/sse-nuxt-ui/docs/node_modules/nuxt-component-meta/dist/parser.mjs:36:28)
  at /D:/next/sse-nuxt-ui/docs/node_modules/nuxt-component-meta/dist/module.mjs:182:16
  at async /D:/next/sse-nuxt-ui/docs/node_modules/nuxt/dist/index.mjs:2345:7
  at async generateApp (/D:/next/sse-nuxt-ui/docs/node_modules/nuxt/dist/index.mjs:5182:3)
  at async _applyPromised (/D:/next/sse-nuxt-ui/docs/node_modules/perfect-debounce/dist/index.mjs:54:10)
adamdehaven commented 6 days ago

This should be resolved as of 0.9.0 https://github.com/nuxtlabs/nuxt-component-meta/releases/tag/v0.9.0