How to compile and run svelte in browser ? | Sololearn: Learn to code for FREE!


How to compile and run svelte in browser ?

Can the following cdn url or any other svelte cdn do compilation in browser ?

9/9/2021 10:29:31 AM


1 Answer

New Answer


You can compile it with svelte.compile it takes in a string and returns the compiled code for the component. You will have a terrible dx doing it this way, and half of the point of svelte is the dx so I wouldn't recommend it. Also it would make svelte very slow which removes the other benefits of svelte, so basically if you are forced to do non compiled js I would recommend react,vue, or ractive by the way that is how the svelte repl works