Snippets have incorrect scope when component variables are used as components

#16708

Development PR

Issue

Solved
H
hanielu
Sep 3, 2025, 5:05 PM

Describe the bug

Snippets don't have the correct scope for when variables are used as components

<script lang="ts">
  import { motion } from "./motion.svelte";
  const layout = motion;
</script>

<!-- THIS WORKS -->
<!-- <layout.ul>Hello World</layout.ul> -->

<!-- THIS DOESN'T WORK -->
{@render test()}

{#snippet test()}
  <layout.ul>Hello World</layout.ul>
{/snippet}

Reproduction

System Info

System:
    OS: macOS 15.5
    CPU: (12) arm64 Apple M2 Max
    Memory: 101.75 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.11.0 - /opt/homebrew/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 10.13.1 - /opt/homebrew/bin/pnpm
    bun: 1.2.19 - ~/.bun/bin/bun
    Watchman: 2025.04.28.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 140.0.7339.80
    Edge: 139.0.3405.125
    Safari: 18.5
  npmPackages:
    svelte: ^5.0.0 => 5.38.6

Severity

annoyance

Info

Closed at Sep 11, 2025, 12:20 AM
Assignees None
Labels None
Milestone None