Story Details

  • Svelte 5 is not JavaScript

    Posted: 2025-02-18 16:29:46

    Svelte 5 significantly departs from its JavaScript framework roots by compiling components directly to vanilla JavaScript instructions that manipulate the DOM. This eliminates the virtual DOM diffing process typical of other frameworks, resulting in smaller bundle sizes and potentially faster performance. Instead of a framework mediating interactions, Svelte 5 generates imperative code tailored to each component, directly updating the DOM. This shift allows for optimized updates and reduces runtime overhead, making Svelte 5 applications more akin to handcrafted JavaScript than traditional framework-driven applications. While still using familiar Svelte syntax, the output is now a highly optimized, self-contained JavaScript module.

    Summary of Comments ( 192 )
    https://news.ycombinator.com/item?id=43091596

    HN users discuss Svelte 5's compilation strategy, which moves reactivity out of the JavaScript runtime and into compiled code. Several commenters express excitement over the potential performance benefits and smaller bundle sizes, comparing it favorably to React and other frameworks. Some raise concerns about debugging and the implications for the ecosystem, particularly around tooling. A few express skepticism, questioning whether the performance gains are significant enough to warrant the shift and whether Svelte's approach will hinder wider adoption. There's also discussion about the blurring line between frameworks and compilers, and whether Svelte's compiled output still qualifies as JavaScript. The impact on hydration and server-side rendering is also a topic of interest.