How to compile and run svelte in browser ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

9th Sep 2021, 10:29 AM
Abhay
Abhay - avatar
1 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
20th Sep 2021, 2:40 PM
Zachiah sawyer
Zachiah sawyer - avatar