Why Svelte is called a compiler while other frameworks are called transpilers

535 Views Asked by At

I recently got this question in school about frontend javascript frameworks, "Why are other frameworks that convert code into vanilla javascript called transpilers, but Svelte is called a compiler?". I couldn't find anything about it on the internet and I don't really understand it. Could someone please explain it to me in simple terms?

1

There are 1 best solutions below

3
brunnerh On

Technically Svelte is also a transpiler. The main distinction between the terms is that a transpiler converts source code to source code while a compiler should convert source code to machine code (much more low level).

Svelte outputs JS, which is still a high level language but at the same time, the code is not exactly what you would call "human readable" and JS is the lowest level web front-end language that you can compile to with the exception of WebAssembly (which is not always an option due its limitations, like not being able to access the DOM directly).