Skip to content

Svelte 5: Misleading errors on non-existent sub-runes outside of Svelte files #12031

Closed
@brunnerh

Description

@brunnerh

Describe the bug

If a sub-rune like $state.x() does not exist, the error in a .svelte.js file states:

rune_outside_svelte
The $state rune is only available inside .svelte and .svelte.js/ts files

(Same for other runes like $effect, found via the now missing $effect.active().)

Reproduction

// test.svelte.js
export let count = $state.x({ value: 0 });

REPL

Logs

No response

System Info

REPL

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