NuxtN
Nuxt6mo ago
5 replies
magius

Use Custom prose component with nuxt/mdc

Hi, I need help with something:

I'm trying to use Nuxt MDC without Nuxt Content (the goal is to reduce the build size, and I don’t need the other features of Nuxt Content since my content comes from a headless CMS, not markdown files).

So far, it's working as expected.

But now, when I try to override the default prose components with my custom ones, it doesn’t work — the default ones are still being loaded.

I followed this part of the documentation:
https://github.com/nuxt-modules/mdc/tree/main?tab=readme-ov-file#prose-components

But when I do that, all my other components (not related to MDC/PROSE) stop working.

I’m not using Nuxt UI in this project

I started from the version shown in the docs and made some fixes to get my base components working again:

mdc: {
  components: {
    prose: true
  }
},
components: [{
  path: '~/components',
}, {
  global: true,
  path: './components/prose',
  pathPrefix: false,
}]


I think the problem comes from the auto-import system.
When I follow the Nuxt MDC documentation, it overrides the global auto-import of my base components to load only the prose ones.

I could fix it by manually importing the non-prose components, but that’s not ideal.
GitHub
MDC supercharges regular Markdown to write documents interacting deeply with any Vue component. - nuxt-modules/mdc
GitHub - nuxt-modules/mdc: MDC supercharges regular Markdown to wri...
Was this page helpful?