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.15.10
Node v20.10.0
System macOS (arm64)
Package Manager pnpm
Output server
Adapter @astrojs/cloudflare
Integrations @astrojs/svelte
Describe the Bug
When running and accessing a built astro app that uses svelte components and the CloudFlare workers adapter, it emits lifecycle_outisde_component errors. Only applies when using svelte 5.
[wrangler:inf] Ready on http://localhost:8788
[wrangler:inf] GET / 200 OK (16ms)
✘ [ERROR] Uncaught (in promise) Error: lifecycle_outside_component
✘ [ERROR] Uncaught (in response) Error: lifecycle_outside_component
From a quick investigation, it seems like the components are importing the client bundle when running in SSR. If I import and log out svelte's onMount() method from the component, it emits the client implementation rather than the noop implementation expected on the server. Could relate to worker import conditions?
Details
This issue exists both when using the provided version of vite-plugin-svelte (v3) and overriding the version to v4.
Issue does not seem to occur when using svelte 4
Issue does not seem to occur when using a different astro adapter (e.g node)
Astro Info
Describe the Bug
When running and accessing a built astro app that uses svelte components and the CloudFlare workers adapter, it emits
lifecycle_outisde_component
errors. Only applies when using svelte 5.From a quick investigation, it seems like the components are importing the client bundle when running in SSR. If I import and log out svelte's
onMount()
method from the component, it emits the client implementation rather than the noop implementation expected on the server. Could relate to worker import conditions?Details
vite-plugin-svelte
(v3) and overriding the version to v4.What's the expected result?
Expected page to render as normal without errors.
Link to Minimal Reproducible Example
https://github.com/giraugh/astro-svelte-5-cloudflare-repro
Participation
The text was updated successfully, but these errors were encountered: