N
Nuxt2mo ago
Naeem

npm run generate command _payload.json folder get created for specific route

experimental: { payloadExtraction: true, }, I have set above flag set, for only one route it generates _payload.json folder and it contain index.html, while for all other routes _payload.json files(which I am expecting) technologies/_payload.json/index.html correct format technology/power-bi/_payload.json I did deleted node_modules, .nuxt, .output folder, same result. Working directory: /app nuxi 6:46:15 PM Nuxt project info: nuxi 6:46:15 PM ------------------------------ - Operating System: Linux - Node Version: v20.19.5 - Nuxt Version: 3.17.6 -CLI Version: 3.25.1 - Nitro Version: 2.11.13 - Package Manager: npm@10.8.2 - Builder: - - User Config: runtimeConfig, ssr, experimental, features, app, css, modules, carousel, gtag, googleFonts, image, robots, strapi, nitro, compatibilityDate - Runtime Modules: @bootstrap-vue-next/nuxt@0.16.6, nuxt-feather-icons@1.2.1, vue3-carousel-nuxt@1.1.0, @pinia/nuxt@0.5.1, @nuxtjs/strapi@1.11.0, @nuxtjs/robots@3.0.0, @nuxt/image@1.10.0, @nuxtjs/google-fonts@3.2.0, @nuxtjs/fontaine@0.5.0, nuxt-gtag@3.0.3 Does anyone knows what I am missing, please help!!
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @Naeem. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information in the knowledge sources, the experimental.payloadExtraction option (enabled by default) should extract payloads for prerendered pages when you run nuxt generate. This typically results in a _payload.json file for each prerendered route, such as technology/power-bi/_payload.json if that route is prerendered. Your config:
export default defineNuxtConfig({
experimental: {
payloadExtraction: true
}
})
export default defineNuxtConfig({
experimental: {
payloadExtraction: true
}
})
is correct for enabling this feature Docs: payloadExtraction. However, you are seeing _payload.json/index.html for only one route, and not the expected _payload.json files for others. The knowledge sources do not provide a direct explanation for this specific behavior, but here are some points to consider: - Payload extraction only occurs for prerendered pages. If a route is not being prerendered (i.e., not discovered by the crawler or not explicitly listed in your nitro.prerender.routes), its payload will not be extracted Docs: Prerendering. - Routes must be discoverable. The Nitro crawler only prerenders routes it can find via links or those you specify in the config. If your routes (like technology/power-bi) are not linked from other pages or not listed in prerender.routes, they will not be prerendered and thus no payload will be extracted for them. - Manual configuration may be needed. You can ensure specific routes are prerendered (and thus have payloads extracted) by adding them to your config:
export default defineNuxtConfig({
nitro: {
prerender: {
routes: ['/technology/power-bi'],
},
},
})

export default defineNuxtConfig({
nitro: {
prerender: {
routes: ['/technology/power-bi'],
},
},
})

Docs: Selective Pre-rendering - Experimental features and bugs. There have been recent changes and fixes related to payload extraction, including support for development mode and fixes for payload extraction logic (PR #30784, PR #31167, PR #33158). If you are on a recent Nuxt version, you should have these fixes, but if not, consider updating. Summary:
The most likely reason you are not seeing _payload.json files for all routes is that those routes are not being prerendered. Make sure all desired routes are either linked from other pages or explicitly listed in your nitro.prerender.routes config. If the issue persists even after this, it may be related to a bug or a limitation not covered in the current documentation. If you have already ensured all routes are prerendered and the problem remains, the knowledge sources do not provide enough information to diagnose further. In that case, consider opening an issue on the Nuxt GitHub repository with a minimal reproduction. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@1407079988888473693> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Naeem
NaeemOP2mo ago
@kapa.ai No, for the where I see folder is not correct, any idea how could that be fixed?

Did you find this page helpful?