Skip to content

Conversation

@benjamincanac
Copy link
Contributor

@benjamincanac benjamincanac commented Oct 17, 2025

This PR adds a component-meta:schema hook to alter the schema before it is being written on disk.

I need this on the Nuxt UI docs as the component-meta.mjs is 13MB (110+ components), by removing the meta.slots[].schema (which I don't need) the file size goes down to 5MB:

import type { NuxtComponentMeta } from 'nuxt-component-meta'

export default defineNuxtConfig({
  hooks: {
    'component-meta:schema': (schema: NuxtComponentMeta) => {
      for (const componentName in schema) {
        const component = schema[componentName]

        if (component?.meta?.slots) {
          for (const slot of component.meta.slots) {
            delete (slot as any).schema
          }
        }
      }
    }
  }
})

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 17, 2025

npm i https://pkg.pr.new/nuxt-component-meta@95

commit: 9b77589

@atinux atinux merged commit e0cf57d into main Oct 17, 2025
3 checks passed
@atinux atinux deleted the feat/schema-hook branch October 17, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants