Prerendering fails when we use Nuxt content v2 with Nuxt 3
See original GitHub issueEnvironment
Nuxt CLI v3.0.0-rc.4 11:15:44 RootDir: /Users/fayaz/Opensource/logspot 11:15:45 Nuxt project info: 11:15:45
- Operating System:
Darwin
- Node Version:
v16.13.1
- Nuxt Version:
3.0.0-rc.4
- Package Manager:
yarn@1.22.19
- Builder:
vite
- User Config:
modules
,content
- Runtime Modules:
@nuxtjs/tailwindcss@5.1.3
,@nuxt/content@2.0.1
- Build Modules:
-
Reproduction
Open this stackblitz link - https://stackblitz.com/edit/nuxt-starter-hgwgav?file=app.vue
- Install the dependencies -
npm install
- Run the dev server -
npm run dev
- you can see it runs fine - Stop and run
npm run generate
- You can see the error below
ERROR 'fetchContentNavigation' is not exported by virtual:nuxt:/home/projects/nuxt-starter-hgwgav/.nuxt/imports.mjs, imported by node_modules/@nuxt/content/dist/runtime/components/ContentNavigation.mjs
Describe the bug
I am using the useAsyncData
in my setup script to retrieve data from content folder.
<script setup>
const { data: posts } = await useAsyncData('feed', () =>
queryContent('/').find()
);
</script>
Additional context
Note, this is only happening when we use it with Nuxt content module. I created a different project without nuxt content and npm run generate
worked without any issues.
Logs
ERROR 'fetchContentNavigation' is not exported by virtual:nuxt:/home/projects/nuxt-starter-hgwgav/.nuxt/imports.mjs, imported by node_modules/@nuxt/content/dist/runtime/components/ContentNavigation.mjs
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top GitHub Comments
Go to: https://vinayakkulkarni.dev
If you go to the blog link & then navigate to main page by clicking on the logo on the top, the main screen/page content isn’t shown 😦
Repo source code: https://github.com/vinayakkulkarni/vinayakkulkarni.dev
Using Nuxt 3 w/ Nuxt content v2 deployed to netlify
I haven’t looked into this, but it might be fixed by https://github.com/nuxt/framework/pull/5763.