nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.03k stars 618 forks source link

useContent not working with ssr: false #2363

Open Gimanh opened 9 months ago

Gimanh commented 9 months ago

Environment

Operating System: Darwin Node Version: v16.17.1 Nuxt Version: 3.7.3 CLI Version: 3.8.4 Nitro Version: 2.6.3 Package Manager: npm@8.15.0 Builder: - User Config: modules, content Runtime Modules: normalizedModule(), @nuxt/content@2.8.2 Build Modules: -

Reproduction

Clone repository https://github.com/Gimanh/nuxt-content-bug

Describe the bug

Add content into [...slug.vue]

<template>
  <main>
    <ContentDoc />
      {{ data.navigation }}
  </main>
</template>

<script setup>
const data = useContent()
console.log( data.navigation );
</script>

You will see navigation data Then Set ssr: false in nuxt.config useContent will return undefined

Additional context

No response

Logs

No response

wikett commented 5 months ago

I have found a solution here: https://github.com/nuxt/content/issues/2356#issuecomment-1740683996

Hope you sorted