Live data from Hacker News

Svelte – A UI framework that compiles into tiny standalone JavaScript modules

svelte.technology

131–140 of 236 posts

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#131

This looks nice: a Javascript framework for expressing _concepts_ that compiles down to vanilla JS. It looks like it ships a lot less code to the user. From the project's first [blog post]( https://svelte.technology/blog/frameworks-without-the-framew... ): > The Svelte implementation of TodoMVC weighs 3.6kb zipped. For comparison, React plus ReactDOM without any app code weighs about 45kb zipped. It takes about 10x a…

I didn't study the thing, but the first question that comes to my mind is: if each component is rendered as a self contained piece of vanilla js, isn't the size of an app with lots of components going to increase much faster than with the library approach? A complete library by itself can be pretty big, but it stays the same size no matter how many components you add.

It seems like most of weight of the code is VanillaJS's somewhat verbose methods like document.createTextNode or "e.parentNode.removeChild".

I suppose that's why it's so critical that the app zips down while it's going across the wire.

I can't help but wonder if shipping a rudimentary bootstrap framework that wraps those methods would be helpful.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#132

The precompilation is a nice idea, but I'm not buying the "vanilla JS" argument. The reason why React and other frameworks have a runtime is also because they optimize rendering. The Svelte doc says: every call to `component.set()` produces a synchronous DOM update. I can already see how this leads to very poor rendering performance in applications with a large number of nested components. React and the Virtual DOM s…

Haven't studied the SvelteJS documentation but as far as I can reason there is nothing in their idea that prevents them from shielding the DOM behind a lightweight, virtual DOM, ReactJS style. In fact, I'd be slightly disappointed if they don't shield the DOM somehow. It's the #1 bottleneck, after all.

Check the generated code in the REPL, it's straight DOM manipulations.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#133

Earlier quoted context omitted.

Haven't studied the SvelteJS documentation but as far as I can reason there is nothing in their idea that prevents them from shielding the DOM behind a lightweight, virtual DOM, ReactJS style. In fact, I'd be slightly disappointed if they don't shield the DOM somehow. It's the #1 bottleneck, after all.

Check the generated code in the REPL, it's straight DOM manipulations.

Hope they have good reasons, then..

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#135

The precompilation is a nice idea, but I'm not buying the "vanilla JS" argument. The reason why React and other frameworks have a runtime is also because they optimize rendering. The Svelte doc says: every call to `component.set()` produces a synchronous DOM update. I can already see how this leads to very poor rendering performance in applications with a large number of nested components. React and the Virtual DOM s…

Haven't studied the SvelteJS documentation but as far as I can reason there is nothing in their idea that prevents them from shielding the DOM behind a lightweight, virtual DOM, ReactJS style. In fact, I'd be slightly disappointed if they don't shield the DOM somehow. It's the #1 bottleneck, after all.

The virtual DOM isn't a replacement for the DOM, it's just a string diffing algorithm. It is only needed because of React's "render everywhere" approach, which is a tradeoff sacrificing efficiency for simplicity. If you don't re-render the entire page any time the model changes, you don't need a virtual DOM.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#136
So I've just wrapped up using React + Redux and just begun to uneasily accept JSX.

It makes me uneasy because React wraps up existing HTML with Javascript. Because it violates using existing, established standards that have truly stood the test of time and wasn't broken at all.

Svelte really hits that sweet spot.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#137

Earlier quoted context omitted.

If the thing that I'm abstracting is routine, and unrelated to the business problem I'm solving, I don't need to know what's happening (at least in the sense of me or someone else coming back to read the code later). I don't need to know how an HTTP server, or the particulars of an AJAX request work most of the time.

true, but when there is something unexpected about how the AJAX request or the HTTP server are working then debugging is going to be harder because of the abstraction.

No, the work in fact will be easier - because something unexpected will either happen above, below or on abstraction boundary - as opposed to "somewhere in this big blob of function invocations". Also, you'll get to fix the bug in one place instead of having to hunt down every similarly looking piece of code because it may contain the same issue.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#138
post #75
post #52

Earlier quoted context omitted.

The point is, don't take things to the extreme :) It's not that people said "Everything is bad, do assembly". It's just that people identified 2WB as problematic and you just shouldn't do that one thing.

Currently JS frontend folks also classify MVC as "problematic", yet a lot of successful software was written that way. So along with J2EE folks, this isn't really the community to look for style standards by default.

Honestly, given that I know of no two developers that have the same understanding of what MVC is and how the code should be divided, I have a feeling there's something wrong with the pattern itself, too.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#139
Looks neat, but also like a non-standard implementation of Web Components, which, though slow coming, already have universal browser support with a small shim.

What's the advantage of this over something like Google's Polymer library, which is a toolkit for rapidly creating reactive web components?

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#140
post #96

Love the ideas. I think now the community has settled on the Component based development, especially with JSX templates. What we need are multiple react-kernels implementations. I see React community providing component API specs. Similar to Linux distros, we should have API compatible implementations, where application code can run on multiple kernels without any changes. We are now seeing multiple react-shim layer…

Here's another JSX with Web Components: https://github.com/wisercoder/uibuilder

Unlike React etc this lib used W3 Components which are far superior because of Shadow DOM, which is already implemented in Chrome.

Post reply on HN