-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
See code in reproduction, watch it fail to compile with error Cannot reference store value inside <script context="module"> . However $state is used inside function which creates state only when it is used, defining the same function in regular .ts file does not cause any issues. I would expect behavior to match.
Possibly related #10034
Reproduction
<script lang="ts" context="module">
export const createState = () => {
const state = $state({
open: false,
})
return state
}
</script>
<script lang="ts">
let state = createState()
</script>Logs
No response
System Info
"svelte": "5.0.0-next.38",Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels