Svelte

I discovered Svelte, yet another Javascript framework, a month ago or so. I’ve been using Preact for a few months now, but I decided to jump ship after trying Svelte yesterday: it’s simply doing better at what I want it to do.

First, Svelte doesn’t use a virtual DOM, so its bundle size and time-to-interactive are smaller. 25% smaller bundles compared to Preact from the official benchmark, but I’m already seeing better results with my toy project. It’s easy to split code almost out of the box using Webpack and import statements, and everything is done at build time.

Regarding static site generation, Svelte doesn’t rely on JSX, so rendering components to HTML strings is way faster and it doesn’t require much configuration–only a tiny webpack script. For this reason, it scales way better than Preact when you have to generate thousands of pages. My webpack build also runs blazingly fast because it doesn’t rely on things like Babel presets, and that feels great when I need to tweak code and get instant feedback.

Last but not least, I love the syntax. It’s just pure HTML and Javascript with no fluff, minimalist, and easy to read and write. It simply feels more native to the Web because it leverages existing technologies instead of adding abstraction layers. Being able to use lightweight vanilla Javascript libraries without writing a React adapter is refreshing.

Svelte also has its own NextJS-like framework called Sapper. I don’t plan to use it because I need to have total control over how my static webpages are built, but I definitely see it becoming a faster alternative to Next and Gatsby.