[ad_1]
Rolldown (just open-sourced) might be the most important web project of the next 5-10 years. I thought it might be helpful to explain why:
The landscape:
Rollup is the best and most comprehensive bundler to date. It was ahead of its time, pioneering key concepts like tree shaking ( @Rich_Harris & @lukastaegert) and still hasn’t been matched in this regard. When @youyuxi introduced @vite_js — Rollup was a cornerstone of the build process. Vite plugins are (for the most part) Rollup plugins.
It didn’t take long for Vite to become the standard development and build environment for nearly every major meta framework: @nuxt_js, @solid_js start, @sveltejs kit, @remix_run, @angular cli, etc. (basically everything except Next). Rollup is still the underpinning of all of these. It has gone from being a way to bundle your library before publishing on npm to the backbone of how the modern web is being written.
The problem:
We find ourselves in a world where Rollup has been pressed into service building nearly every byte on the web — something it wasn’t originally intended to do — and its performance (really JavaScript’s performance) could be improved. esbuild ( @evanwallace), a bundler written in Go, showed the world just how much faster a “native” bundler can be, but esbuild was not Rollup compatible and had its fair share of shortcomings as well (no TypeScript, limited tree shaking, etc.).
@vite_js uses esbuild and Rollup to get the best of both worlds, but here lies another problem: parsing. Different build tools use different AST trees, and each of these must parse the code to derive the AST. Also, many plugins for Rollup/Vite perform their own parsing. Wouldn’t it be incredible if the parsing was done a single time and a single AST tree could be used by all layers of the build stack?
@youyuxi said recently that @vite_js often has to parse the same TS file at least 5 times at various levels in the stack. Clearly this could be better.
The solution:
The Rolldown project is attempting to (eventually) solve all of these problems. First, it is written in Rust, one of the fastest languages out there — generally even faster than Go (i.e., esbuild) due to Rust not using garbage collection. In some applications, this doesn’t matter much, but in the context of parsing and compiling, this is a big benefit (oh the irony that Rust itself is the world’s slowest compiler ). Plus, people like @ThePrimeagen talk about Rust — somehow that makes it fast by proxy.
Rolldown isn’t just attempting to be fast though, it is also attempting to be API compatible with Rollup. This would be a monumental accomplishment (the Rollup API is not for the faint of heart). If successful, the @vite_js team could swap out the engine inside Vite while the plane is flying.
Finally — and perhaps most ambitiously — a standard singular parse. Perhaps this is a bit further down the road, but because Vite is so prevalent and because Rolldown uses OXC ( @boshen_c) for parsing, we could end up in a world that standardizes around a single parse and AST tree. The performance improvements we could see in our development environment and build times would be tremendous.
If successful, Rolldown will be responsible for transforming nearly every byte of web code — no matter what framework you use.
Thanks:
Finally, thanks to the @vite_js team, and everyone working on @rolldown (@_hyf0, @_h_ana___, @youyuxi)! I am in no way affiliated with these fine engineers, just a mere plebe building on the backs of these giants.
Re-posted from here:
// Detect dark theme
var iframe = document.getElementById(‘tweet-1766115866859446477-570’);
if (document.body.className.includes(‘dark-theme’)) {
iframe.src = “https://platform.twitter.com/embed/Tweet.html?id=1766115866859446477&theme=dark”
}
[ad_2]
Source link