Live data from Hacker News

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

svelte.technology

151–160 of 236 posts

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

#151
TodoMVC is a useless benchmark for the problem that this claims to be addressing. The limits we're hitting with our applications now are with BIG applications, with many routes, many views, and lots of client side logic. We're talking hundreds of files (in some cases, thousands). Of course a framework, with it's fixed overhead, is going have a bigger payload for a tiny demo app like TodoMVC, than something like this which compiles to some amount of overhead which grows seemingly linearly with application size.

That said, I'm not criticizing the framework here, and I welcome new ideas, but a better choice of benchmark is sorely needed to be persuasive here.

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

#152
post #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?

Polymer is an enormous library.

Thats completly untrue - polymer is close in size to jquery and a lot smaller than react core for example.

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

#153
post #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?

Web Components (or Polymer) when combined with JSX is awesome: https://github.com/wisercoder/uibuilder

Shadow DOM lets you build reliable, reusable components.

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

#154

Earlier quoted context omitted.

Tried to click the link, but the REPL is apparently so advanced that it won't even display the source code in Firefox.

The Svelte compiler uses some ES2015 features (for...of, etc) that aren't currently supported in all browsers. It's designed primarily for use in Node.

Also doesn't work on Safari 9.

Why not transpile the Svelte compiler to ES5 so it will run on all browsers? Otherwise devs may get the impression Svelte generated applications will not work on all browsers.

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

#155
post #143

Earlier quoted context omitted.

Polymer offers a lot of UI widgets, which are enormous when you glob them together, but the base polymer library is actually incredibly small due to the fact that's it's leveraging the browser's native custom element functionality. Can't reply to your comment so editing here: Works natively on IE11+, Edge, Safari 9+, Chrome, Opera, Firefox, and mobile browsers. The polyfill for everyone else (webcomponents-lite.js) i…

Ok, it has been some time since I checked. Don't you need lots of big polyfills ?

No - 95% of time you need that webcomponents-lite to get things working.

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

#156

Love it. I think the most discussion-worthy quote I found in the docs is this: > It's currently fashionable to avoid two-way binding on the grounds that it creates all sorts of hard-to-debug problems and slows your application down, and that a one-way top-down data flow is 'easier to reason about'. This is in fact high grade nonsense. It's true that two-way binding done badly has all sorts of issues, and that very la…

"Used correctly" to me sounds like: "with much knowledge, experience, care, and luck" ie. a footgun, especially for beginners.

Similar things have been said about memory allocation in 'do whatever you want' languages like C++.

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

#157

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…

We'll publish some benchmarks soon showing how much better Svelte's performance is than React's. There's a lot of misconceptions around virtual DOM diffing.

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

#158

I like the idea of abstractions that exist only in the source code and at compile time, and have zero runtime footprint. How does this compare to Google's Closure compiler and library? Does Svelte's compiler do anything that the Closure compiler cannot? Or how about running the source through a hygienic macro system like sweet.js and feeding the output of that to the Closure compiler? I ask because I'm skeptical of a…

Svelte has a far deeper understanding of your app than a general purpose compiler like Closure ever could. For best results, use both together.
Post reply on HN