Live data from Hacker News

Why Svelte is our choice for a large web project

github.com

41–50 of 136 posts

Re: Why Svelte is our choice for a large web project

#41
post #15

I love svelte. but now resorting to server rendered html pages with sprinkles of JS. shit I work on and I have noticed in the world doesn't really need frameworks like react, svelte, vue etc.

Svelte can do server-rendered and static page generation with the near-zero overhead of string concatenation, and with it you gain the component model. Part of the magic of compilers is that you can get most of the best of both worlds. Sapper provides both of these use cases.

Re: Why Svelte is our choice for a large web project

#42
I love the idea of svelte and want to try it on my next project.

The compiler paradigm is really powerful. What if you could extend Svelte to give it knowledge of your db schema and it would figure out an optimized way to load data by generating all that code if needed. Probably something like this exists already somewhere and was forgotten about, but one can dream.

Re: Why Svelte is our choice for a large web project

#43
post #37

> Svelte is one of the 6 JS frameworks in the (flawed) State of JS 2019 survey — 75% have heard of it, 7% have used it, and 45% are interested in learning more Why is it flawed and why are you citing a flawed study? You mention that it's flawed twice but then immediately cite data from it. If you're telling me it's flawed why should I care about the data?

It's a type of opinion that should warrant it's own blog post, at the very least.

Re: Why Svelte is our choice for a large web project

#44

Author here, just wanted to make a note. This isn't written to hype a battle in the holy war. Frontend frameworks are a positive sum game! Svelte has no monopoly on the compiler paradigm either. Just like I think React is worth learning for the mental model it imparts, where UI is a (pure) function of state, I think the frontend framework-as-compiler paradigm is worth understanding. We're going to see a lot more of i…

Thank you. I hope you will do a write-up of your experiences when the project is completed.

Re: Why Svelte is our choice for a large web project

#45
post #37

> Svelte is one of the 6 JS frameworks in the (flawed) State of JS 2019 survey — 75% have heard of it, 7% have used it, and 45% are interested in learning more Why is it flawed and why are you citing a flawed study? You mention that it's flawed twice but then immediately cite data from it. If you're telling me it's flawed why should I care about the data?

I considered linking or footnoting that text and probably should have.

Like all surveys, there's a selection bias. For example where are the world's millions of jQuery developers?

There's also a lot of controversy around Angular's treatment in the survey and an alleged pro-React bias. This shouldn't affect the Svelte numbers much.

Thanks for bringing it up - I'll improve the text somehow.

Re: Why Svelte is our choice for a large web project

#46
post #15

I love svelte. but now resorting to server rendered html pages with sprinkles of JS. shit I work on and I have noticed in the world doesn't really need frameworks like react, svelte, vue etc.

Same. I haven't done frontend work for a job for about a decade, but kept up to date with things like Angular/Vue/React. I was recently vountold by my wife to create a reunion site for her class. I looked up "barebones front end frameworks." Anything that began the "Getting Started" page with "npm install" I noped out of there. I ended up with Skeleton/jQuery for the front end and PHP Slim for the backend. This is a…

> Anything that began the "Getting Started" page with "npm install" I noped out of there.

> I ended up with Skeleton/jQuery for the front end

So rather than install a dependency via a package manager you installed it manually. Okay.

Re: Why Svelte is our choice for a large web project

#47
post #20

Especially excited to consider a solution without huge runtime libraries (think jQuery, React, Vue). Minimizing web page sizes and enabling dynamic content (which is a mainstay in modern websites) is a huge plus.

React 16 is 2.2 KB or 34.8 KB if you include react-dom, Vue 2.4 is 20.9 KB, and jquery 2.1 is 28.87 KB. If you're using a bundler that can create chunks, your user is at best downloading this once in a blue moon. The reply page I'm using now is 10% bigger total than these packages and has to be pulled every time apparently. By what metric are these "huge runtime libraries"?

> React 16 is 2.2 KB or 34.8 KB if you include react-dom

Gzipped. Uncompressed React is 6.3KB and react-dom is 114.5KB (and of course you're going to include react-dom, how else would you use it?!)

Uncompressed matters because it takes a device longer to parse more code. Particularly in a world where low end Android devices are being shipped with slow CPUs and very little RAM.

The real killer combination is React plus a giant blob of state that has to be parsed, and then hydrated into individual elements. It's a giant, giant waste of CPU time that is acceptable on my iPhone XS, but when I plug in a Nokia 2 it's horrifying. VDOM itself is needlessly CPU intense in many ways.

Even if you don't want to use Svelte it baffles me that more people don't use Preact. 9.5KB uncompressed and it does 95% of what React does. But people just don't seem to care.

Re: Why Svelte is our choice for a large web project

#48
post #46

Earlier quoted context omitted.

Same. I haven't done frontend work for a job for about a decade, but kept up to date with things like Angular/Vue/React. I was recently vountold by my wife to create a reunion site for her class. I looked up "barebones front end frameworks." Anything that began the "Getting Started" page with "npm install" I noped out of there. I ended up with Skeleton/jQuery for the front end and PHP Slim for the backend. This is a…

> Anything that began the "Getting Started" page with "npm install" I noped out of there. > I ended up with Skeleton/jQuery for the front end So rather than install a dependency via a package manager you installed it manually. Okay.

Calling Skelton a dependency is ludicrous. It's just an HTML file with a CSS file. Look at every other "lightweight CSS framework" - Specture, Mustard UI, etc. They all have dozens and dozens of files where you need a package manager.

The whole point was that it's simple enough that I don't have to deal with a package manager, and a lot of projects don't need to.

Re: Why Svelte is our choice for a large web project

#49
Ah, I mentioned it on Twitter [1] somewhat prompted by seeing this article, but before reading it, but:

> It's interesting that Svelte is positioned as a Javascript framework: it seems to be practically a different language, far more so than JS+JSX.

> The downside is that it's hard to integrate with much of the Javascript ecosystem, e.g. TypeScript.

> Yet at the same time, it doesn't fully embrace being a different language, so it does not add features like e.g. how Elm supports pattern matching.

> It does make it an easier sell, I suppose, which does certainly count for something. Am I missing something else?

After having read it, it does seem that the author does both consider it a separate language, but also still presents it as a JS framework. I wonder if the former isn't being underestimated?

[1] https://twitter.com/VincentTunru/status/1237422539128868865

Re: Why Svelte is our choice for a large web project

#50

I like what I see from Svelte but I'm afraid it's going down the exact same road Meteor did. Too many options, not enough Blessed Solutions for basic things. Take routing for example, in Svelte you have a lot of options but no real #1 "Svelte Recommends (tm)". They should solve this problem before it gets out of hand. It killed Meteor.

Sapper provides a great option for routing. I view that as the official routing solution, but there are other options too.
Post reply on HN