Skip to content

Svelte 5: client-side render function #12516

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

Open
Rich-Harris opened this issue Jul 20, 2024 · 0 comments
Open

Svelte 5: client-side render function #12516

Rich-Harris opened this issue Jul 20, 2024 · 0 comments

Comments

@Rich-Harris
Copy link
Member

Describe the problem

Per #12512 (comment): it's common in a programmatic snippet to do render(SomeComponent, props).body, but this doesn't work in the browser because SomeComponent is compiled in a way that doesn't work with render.

Describe the proposed solution

Either or both of:

  • a browser version of render that behaves differently in some way (at minimum a more helpful error, but maybe it could return a body string that tells the component that subsequently mounts how to do so)
  • a svelte/environment module akin to $app/environment, providing access to browser and dev

Of course, in an ideal world it would Just Work, but that would require shipping the server-side templating logic to the client, unless there's some clever tree-shaking trickery we can employ.

Importance

nice to have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant