-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Description
Describe the bug
In a component with <script context="module">, some markup, and without <script>; having a writable store be set by an exported function won't cause reactive updates in the markup.
Adding an empty <script></script> will include writable store in compiled output.
Reproduction
Toast component: https://svelte.dev/repl/6c0757bed5044018ba5560733e7b56bf?version=4.2.19
- Click on button labelled "Click me"
- Observe empty Toast message
Workaround:
- Add
<script></script>to the markup - Observe new prop in compiled output (there are more changes in compiled output as well):
/* Toast.svelte generated by Svelte v4.2.19 */
import {
SvelteComponent,
append,
append_styles,
attr,
component_subscribe,
detach,
element,
init,
insert,
noop,
safe_not_equal,
+ set_data,
+ text as text_1,
toggle_class
} from "svelte/internal";- Click button to present a working Toast message
Note this works totally fine in Svelte 5, in both Runes and non-Runes modes. Demo.
Logs
No response
System Info
Svelte 4.2.19Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels