sandpack
sandpack copied to clipboard
An error of svelte/store and lifecycle in svelte template at official demo
Bug report
Packages affected
- [ ] sandpack-client
- [x] sandpack-react
Description of the problem
I'm using tempalte svelte, it throws an error when I import { writable } from'svelte/store' and call onMount/onDestroy at the same time. I also found comment out any item of them would work well.
What were you doing when the problem occurred?
I just use sandpack to my docusaurus@v3 website.
What steps can we take to reproduce the problem?
- open
https://sandpack.codesandbox.io/docs/getting-started/usage. - select
SvelteinTry it out. - copy the code below to editor, the error will occur like the snapshot above.
<script>
import { onDestroy } from 'svelte';
import { writable } from'svelte/store';
onDestroy(() => {
alert(345)
})
</script>
<div>abc</div>
Link to sandbox: link (optional)
Your Environment
| Software | Name/Version |
|---|---|
| Sandpack-client version | |
| Sandpack-react version | 2.9.0 |
| Browser | Chrome 119 |
| Operating System | windows |