Skip to content

Expected a # character immediately following the opening bracket - svelte(block_unexpected_character) #13483

@Blue-Nomad

Description

@Blue-Nomad

Describe the bug

In Svelte 4 I was able to do:

{ #if expression }
    ...
{ :else if expression }
    ...
{ :else }
    ...
{ /if }

{ @html '<div></div>' }

Now in Svelte 5 that's an error. The following works but looks inconsistent:

{#if expression }
    ...
{:else if expression }
    ...
{ :else }
    ...
{ /if }

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE0XNzQqDMBAE4FcZtgcvgvTnFETa59AepG7oQkyCiUKRvHtZKvS0M98cdicrjhOZfic_zkyGHjFSTfkTtaSNXWaqKYV1eam0PzIhZgk-YVk9JzTd4Ae_4yQWeVkZZfAAcFY07BJDLOyo4Zgu_-mQq0ojVrvG-zvPDlU7ydbd2kZPhUI1zWESKzyR0V_lWb7XAM1xxwAAAA==

It works when you disable Runes Mode.

Logs

No response

System Info

System:
    OS: macOS 14.7
    CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
    Memory: 29.51 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.volta/tools/image/node/20.17.0/bin/node
    npm: 10.8.2 - ~/.volta/tools/image/node/20.17.0/bin/npm
  Browsers:
    Chrome: 129.0.6668.60
    Edge: 129.0.2792.65
    Safari: 18.0
  npmPackages:
    svelte: ^5.0.0-next.260 => 5.0.0-next.260

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions