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
I work on a Svelte SDK that needs to provide a script that will execute immediately on the client-side. This approach is the only way that I am aware off to try and accomplish that.
NOTE: I had the same issue with <style> tags, however in that case I was able to workaround it by including the tag itself inside of @html:
{@html`<style>${styles}</style>`}
However, this same solution doesn't work with scripts
The text was updated successfully, but these errors were encountered:
Closing this because I can't reproduce the crash using Svelte 5 and the latest version of SvelteKit. Note however there is a hydration mismatch warning produced by Svelte in the browser logs.
[svelte] hydration_mismatch
Hydration failed because the initial UI does not match what was rendered on the server
Describe the bug
<svelte:element this={"script"}>{@html "console.log(\"hello world\")"}</svelte:element>
to your code<script><!-- HTML_TAG_START -->console.log("hello world")<!-- HTML_TAG_END --></script>
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-4aozhb?description=The%20default%20SvelteKit%20template,%20generated%20with%20create-svelte&file=src%2Froutes%2F%2Bpage.svelte,src%2Froutes%2F%2Blayout.svelte&title=SvelteKit%20Default%20Template
resulting URL: https://sveltejskittemplatedefault4aoz-01al--5173--d3416dfd.local-credentialless.webcontainer.io/ (inspect response to see SSR source)
Logs
System Info
Severity
blocking an upgrade
Additional Information
I work on a Svelte SDK that needs to provide a script that will execute immediately on the client-side. This approach is the only way that I am aware off to try and accomplish that.
NOTE: I had the same issue with
<style>
tags, however in that case I was able to workaround it by including the tag itself inside of@html
:However, this same solution doesn't work with
script
sThe text was updated successfully, but these errors were encountered: