Skip to content

Svelte 5: $state bug with <script context="module"> and <script> #10380

Closed
@dm-de

Description

@dm-de

Describe the bug

There is an error in $state, if $state is defined in
<script context="module">
and also used in <script>.

Instead of returning a correct value, an object is returned.

Reproduction

See function in Drag.svelte.
Comment this line out - and everything is fine.

Bug with <script context="module">:
LINK

But works with additional js file:
LINK

Logs

No response

System Info

running Svelte compiler version 5.0.0-next.45

Severity

blocking an upgrade

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