N
Nuxt3mo ago
magius

Error @nuxtjs/mdc on reload

I got a Error and i dont understand the problem. When i reload a test of the mdc lib with version 0.9 i got this error
<template>
<div class="text-gray-600 dark:text-gray-400 prose prose-sm max-w-none">
<MDC :value="test" tag="div" />
</div>
</template

<script setup lang="ts">
const test= '# Hello MDC'
</script>
<template>
<div class="text-gray-600 dark:text-gray-400 prose prose-sm max-w-none">
<MDC :value="test" tag="div" />
</div>
</template

<script setup lang="ts">
const test= '# Hello MDC'
</script>
i got this code from the exemple of the doc i just remplaced the value of the variable in the nuxtjs/mdc doc
No description
12 Replies
magius
magiusOP3mo ago
bertyn
StackBlitz
Nuxt - Starter (forked) - StackBlitz
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
Jonas
Jonas3mo ago
put MDC in <ClientOnly> That works for me. MDC makes requests to an endpoint in nitro. Not sure, why this happens tho. or make the component client rendered, by adding .client.vue to the file name
magius
magiusOP3mo ago
even with ClientOnly still the same bug
magius
magiusOP3mo ago
No description
magius
magiusOP3mo ago
i made it work with the reproduction but in my project this still dont work i think the prob came from the combination with nuxt ui ok i got the solution without client only add a .npmrc file with shamefully-hoist=true and you can remove the client only it will work
Jonas
Jonas3mo ago
oh yeah, right. i tried shamefully-hoist=true too, but only ClientOnly worked for me
Sagar Kapoor
Sagar Kapoor2mo ago
I am receiving the same issue!
magius
magiusOP2mo ago
you use nuxt/mdc or nuxt/content ?
Wicker
Wicker2mo ago
Had a similar issue using nuxt content in the past. It randomly started giving the error you were getting adding this to nuxt config solved it content: { experimental: { clientDB: true, }, }, idk with mdc has something similar i'm mentinoing this since you refered to nuxt/content
magius
magiusOP2mo ago
for nuxt/mdc you just need to add this file .npmrc
shamefully-hoist=true
shamefully-hoist=true
remove node module and re install the depency with npm i
Sagar Kapoor
Sagar Kapoor2mo ago
Thanks, a quick question, will MDC be able to render Markdown content in a stringified form? PS: Thanks, it works perfectly! I am using pnpm instead of npm and this solution is still working!
magius
magiusOP2mo ago
MDC was created for that he is used behind the curtain by nuxt/content
Want results from more Discord servers?
Add your server