woutdp / live_svelte

Svelte inside Phoenix LiveView with seamless end-to-end reactivity
https://hexdocs.pm/live_svelte
MIT License
1.2k stars 46 forks source link

stores don't seem to work #104

Open chris838 opened 8 months ago

chris838 commented 8 months ago

Following the Svelte docs for creating a simple store, I can't import the exported variable.

woutdp commented 8 months ago

Can you provide the code that doesn't work?

chris838 commented 8 months ago

Hey - thanks for fast response.

I couldn't get the included example for store working either, here: https://github.com/woutdp/live_svelte/tree/master/examples

tw00 commented 1 month ago

Any update on this?

tw00 commented 1 month ago

I was able to narrow this down:

This works fine:

# Example.svelte
<script>
import { writable, derived } from "svelte/store";
</script>

However this breaks:

# Example.svelte
<script>
import store from "./store";
</script>
# store.js
import { writable, derived } from "svelte/store";

export default {}
✘ [ERROR] No matching export in "svelte/store.js" for import "writable"

    svelte/store.js:1:9:
      1 │ import { writable, derived } from "svelte/store";
        ╵          ~~~~~~~~

✘ [ERROR] No matching export in "svelte/store.js" for import "derived"

    svelte/store.js:1:19:
      1 │ import { writable, derived } from "svelte/store";