Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentList component doesn't work inside .md file #1171

Open
avxkim opened this issue May 29, 2022 · 3 comments
Open

ContentList component doesn't work inside .md file #1171

avxkim opened this issue May 29, 2022 · 3 comments

Comments

@avxkim
Copy link

avxkim commented May 29, 2022

Environment

  • Operating System: Darwin
  • Node Version: v15.14.0
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: npm@7.20.6
  • Builder: vite
  • User Config: modules, colorMode, content
  • Runtime Modules: @nuxt/content@2.0.0, @nuxtjs/tailwindcss@5.1.2, @nuxtjs/color-mode@3.0.3
  • Build Modules: -

Reproduction

Create a component "BlogPosts" inside /components/content/BlogPosts.vue with the following contents:

<template>
  <ContentList v-slot="{ list }" path="/blog">
    <div v-for="article in list" :key="article._path">
      <h2>{{ article.title }}</h2>
      <p>{{ article.description }}</p>
    </div>
  </ContentList>
</template>

<script setup lang="ts"></script>

content directory:

= content
== blog
=== index.md
=== post1.md
=== post2.md

blog/index.md:

---
title: 'Home'
navigation: false
---

::blog-posts

shows ({ data }) => emptyNode("not-found", data)

Describe the bug

ContentList component displays nothing

Additional context

No response

Logs

No response

@farnabaz
Copy link
Member

This fixes in #1143 and #1174. Until next release you can use edge version to resolve this issue

- "@nuxt/content": "^2.0.0",
+ "@nuxt/content": "npm:@nuxt/content-edge@latest", 

@titan-65
Copy link

I am getting a TypeError when I had this "content-edge@latest" and run with pnpm.

TypeError [ERR_PACKAGE_IMPORT_NOT_DEFINED]: Package import specifier "#imports" is not defined in package Z:\Developer\recipe-markdown\node_modules\.pnpm\@nuxt+content-edge@2.0.0-27565830.5b81839\node_modules\@nuxt\content-edge\package.json imported from Z:\Developer\recipe-markdown\node_modules\.pnpm\@nuxt+content-edge@2.0.0-27565830.5b81839\node_modules\@nuxt\content-edge\dist\runtime\components\ContentDoc.mjs
    at new NodeError (node:internal/errors:372:5)
    at throwImportNotDefined (node:internal/modules/esm/resolve:461:9)
    at packageImportsResolve (node:internal/modules/esm/resolve:841:3)
    at moduleResolve (node:internal/modules/esm/resolve:997:21)
    at defaultResolve (node:internal/modules/esm/resolve:1218:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_PACKAGE_IMPORT_NOT_DEFINED'
}

Any suggestion on this?

@titan-65
Copy link

Nevermind I used a different package manager (yarn to be exact) and its now working!!!

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

No branches or pull requests

3 participants