sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

An error of svelte/store and lifecycle in svelte template at official demo

Open JOU-amjs opened this issue 1 year ago • 0 comments

Bug report

Packages affected

  • [ ] sandpack-client
  • [x] sandpack-react

Description of the problem

image

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?

  1. open https://sandpack.codesandbox.io/docs/getting-started/usage.
  2. select Svelte in Try it out.
  3. 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

JOU-amjs avatar Nov 09 '23 01:11 JOU-amjs