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

0

How to compile and run svelte in browser ?

Can the following cdn url or any other svelte cdn do compilation in browser ? https://code.sololearn.com/WL5WVTYEhBEQ/?ref=app

9/9/2021 10:29:31 AM

Abhay

1 Answer

New Answer

+1

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