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

Svelte 5: named snippets results in vague errors #11400

Closed
1 task
murl-digital opened this issue Jul 2, 2024 · 1 comment
Closed
1 task

Svelte 5: named snippets results in vague errors #11400

murl-digital opened this issue Jul 2, 2024 · 1 comment
Labels
needs triage Issue needs to be triaged

Comments

@murl-digital
Copy link

murl-digital commented Jul 2, 2024

Astro Info

Astro                    v4.11.3
Node                     v22.3.0
System                   Linux (x64)
Package Manager          bun
Output                   static
Adapter                  none
Integrations             unocss
                         @astrojs/svelte
which: no xclip in (/tmp/bunx-1000-astro@latest/node_modules/.bin:/home/draconium/Desktop/repos/drac.gay/node_modules/.bin:/home/draconium/Desktop/repos/drac.gay/node_modules/.bin:/home/draconium/Desktop/repos/node_modules/.bin:/home/draconium/Desktop/node_modules/.bin:/home/draconium/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/draconium/.pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/rocm/bin:/usr/lib/rustup/bin:/home/draconium/.local/bin:/home/draconium/.cargo/bin:/home/draconium/.local/bin:/opt/postgresql16/bin)

If this issue only occurs in one browser, which browser is a problem?

Describe the Bug

I have a usecase where I want a second named slot (snippet in the case of svelte 5), but trying to do so the way the svelte 5 docs wants me to results in an esbuild error, and a different error about a validate snippet function not existing in some cases.

What's the expected result?

To be able to use svelte snippets in an astro component

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-3etiww?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jul 2, 2024
@bluwy
Copy link
Member

bluwy commented Jul 18, 2024

You cannot use Svelte snippets in an Astro file. They're a Svelte-file only feature as they need to be compiled by the Svelte compiler. You should use Astro's slots feature instead, which is compatible when passed to the Svelte component's slots.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants