Skip to content

Svelte 5: module context export const creates an accessor #9499

@Rich-Harris

Description

@Rich-Harris

Describe the bug

Exports from <script context="module"> are incorrectly treated as component instance return values

Reproduction

<svelte:options runes />

<script context="module">
	export const answer = 42;
</script>

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAEyWNQQqDMBBFrzLMuiCUrlIVeo6mC4kjBOIkZCa1Rbx7k7p87_P4Oy4-kKB57sjTSmjwkRJeUL-pgbwpKFWWWLJrpj-ViUl9ZIFcmAS60bLlXlz2ScFFVvroYHGNcwlksc1VpZj_qyhMLBtlGOB2vdeyO9OxXtXGL55mNJoLHa_jB3ARSEClAAAA

Logs

No response

System Info

next

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