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

Different nuxtData index required #32

Closed
mbegerau opened this issue Jun 26, 2023 · 1 comment
Closed

Different nuxtData index required #32

mbegerau opened this issue Jun 26, 2023 · 1 comment

Comments

@mbegerau
Copy link

mbegerau commented Jun 26, 2023

The nitro plugin looks for the serverRendered property at index 1 of the nuxtData array. But in my case this information is found at index 0. I'm not sure, why this is the case. I'm sorry, I don't have the time to create a reproducible case. Maybe it's because I use type "module" in package.json or use generate command for static hosting (nuxt version 3.5.2). But maybe it would be safer in general to use something like a find function with hasOwn('serverRendered') instead of hardcoding the index, or use the data-ssr attribute.

Here is a screenshot of the nuxtData object using debugger:
image

@mbegerau
Copy link
Author

A workaround that currently works for me is setting the experimental configuration parameter renderJsonPayloads to false. This way the NUXT_DATA_RE regex does not find the script, the nuxtData variable is null and the second check (ssrContext.includes("serverRendered:true")) returns true.

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

1 participant