You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Astro v4.16.16
Node v18.20.3
System Linux (x64)
Package Manager unknown
Output hybrid
Adapter @astrojs/cloudflare
Integrations @astrojs/svelte
Describe the Bug
If I build an Astro website that contains prerendered page with Svelte @render children and Cloudflare integration, the build error occurs. If I remove Cloudflare integration or change prerendered to false, it doesn't.
Build error log:
$ npm run build
19:36:06 └─ /index.htmldocument is not defined
Hint:
Browser APIs are not available on the server.
If the code is in a framework component, try to access these objects after rendering using lifecycle methods or use a `client:only` directive to make the component exclusively run on the client.
See https://docs.astro.build/en/guides/troubleshooting/#document-or-window-is-not-defined for more information.
Stack trace:
GoodLucky777
changed the title
[Cloudflare + Svelte 5] Cannot build if the page is prerendered and contains Svelte 5 @render with Cloudflare
[Cloudflare + Svelte 5] Cannot build with Cloudflare if the page is prerendered and contains passing children to Svelte 5 component
Dec 1, 2024
+1
facing same issue when using @astrojs/cloudflare adapter
getting
✘ [ERROR] Uncaught (in response) Error: lifecycle_outside_component when trying to use svelte context in ssr
and document is not define when try to render children
Astro Info
Describe the Bug
If I build an Astro website that contains prerendered page with Svelte @render children and Cloudflare integration, the build error occurs. If I remove Cloudflare integration or change prerendered to false, it doesn't.
Build error log:
Also,
<slot />
is not working too.What's the expected result?
The build should be successful.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/astro-svelte-cloudflare-prerender-build-error
Participation
The text was updated successfully, but these errors were encountered: