Live data from Hacker News

Introduction to Svelte

daveceddia.com

61–70 of 116 posts

Re: Introduction to Svelte

#61

For those confused about the "29 MB": that's the size of the compiler itself. A compiled Svelte app is tiny . Taking the TodoMVC demo app as an example: React [1] : 289 KiB over the wire (decompresses to 1,255 KiB) Svelte [2] : 28 KiB over the wire (decompresses to 41 KiB) --- [1] http://todomvc.com/examples/react/ [2] https://github.com/sveltejs/svelte-todomvc

FWIW, that React demo should not be used as a network perf comparison in any way:

- It's using an ancient version of React (0.13.3)

- It's a debug build of "React with addons", not a minified prod build

- It appears to include `JSXTransformer.js` as a separate script to handle in-browser JSX compilation

If you were to redo this using a modern version of React and a standard CRA build, I guarantee it would be _much_ smaller.

edit

Just for kicks, I did a quick search and dug up a pre-existing React "TodoMVC" app based on CRA ( https://github.com/ChrisWiles/React-todoMVC ). It's 3 years old, but it was trivial to bump the requirements up to the latest versions of React and react-scripts.

From there, running `yarn build` says that:

    File sizes after gzip:
    
      39.22 KB  build\static\js\2.3ec0f98b.chunk.js
      2.14 KB   build\static\js\main.4514f0a8.chunk.js
      1.73 KB   build\static\css\2.bc2ff3bb.chunk.css
      782 B     build\static\js\runtime~main.0ff4d30b.js
The actual sizes on disk are:

    2.3ec0f98b.chunk.js : 128435b
    main.4514f0a8.chunk.js: 7259b
    2.bc2ff3bb.chunk.css: 5423b
    runtime~main.0ff4d30b.js: 1577b

So yeah, Svelte is certainly going to result in much smaller bundles than a React app, but you have to use a legitimate fair production comparison.

Re: Introduction to Svelte

#62
post #21
post #10

Earlier quoted context omitted.

Ins't /Svelte/ the framework du jour? :)

Doesn't du jour imply that it's the go-to framework of the day? Surely, that would be React :-)

I guess if it's getting a good response on HN along the lines of "it's better than the other ones," it's close? :)

Re: Introduction to Svelte

#63
post #5

I loved Svelte a few years back and still think it's a nice framework with cool ideas. However, a big issue for me using it at a company is that testing (especially unit testing) seems to be an afterthought. This has made it a non-starter for using it with multiple teams working on same code base. Maybe it's changed with Svelte 3 but a library I wrote for it wasn't clear how to test. (Edit sounds same: https://github…

Is there any UI framework where testing isn't an afterthought?

React at least had ReactTestUtils 'officially' and then recommended ReactTestingLibrary & Enzyme as the ecosystem matured: https://reactjs.org/docs/test-utils.html

Re: Introduction to Svelte

#64

Earlier quoted context omitted.

> Imo Vue and Svelte are going backwards Big claims need big evidence.

I said in my opinion. I think going from JSX to templates is a bad idea and going back to where we were.

What exactly JSX offers what templating does not?

Re: Introduction to Svelte

#65

For those confused about the "29 MB": that's the size of the compiler itself. A compiled Svelte app is tiny . Taking the TodoMVC demo app as an example: React [1] : 289 KiB over the wire (decompresses to 1,255 KiB) Svelte [2] : 28 KiB over the wire (decompresses to 41 KiB) --- [1] http://todomvc.com/examples/react/ [2] https://github.com/sveltejs/svelte-todomvc

FWIW, that React demo should not be used as a network perf comparison in any way: - It's using an ancient version of React (0.13.3) - It's a debug build of "React with addons", not a minified prod build - It appears to include `JSXTransformer.js` as a separate script to handle in-browser JSX compilation If you were to redo this using a modern version of React and a standard CRA build, I guarantee it would be _much_ s…

React (v16 minified via CRA, prod mode) was slightly above the 30kb mark afaik.

Re: Introduction to Svelte

#66
post #37

I like reading scientific papers and most examples sections provide rich and intricate outlines of real-life use-cases where the idea can be experimented against. These examples usually involve quite complicated scenarios that "put the idea to the test". One that I recently read involved a solution to the "Challenge Problem" [1] (simulating the movement of a rover) which involves lots of interesting properties and al…

We are not stuck here. Check out realworld app.

Re: Introduction to Svelte

#67
post #7

Earlier quoted context omitted.

That's the compiler, not the output of the compiler. Likewise GCC/LLVM is huge, but helloworld.bin is pretty small.

How big is the source code size of GCC/LLVM? I mean node_modules often contains the full source + dist of the whole dependency chain.

The source-controlled (and somewhat out of date) folder for LLVM is about a gigabyte on my machine.

Re: Introduction to Svelte

#68
post #36

This looks nice. I'm not a framework guy (more on that in a second) but they at least seem to be heading in the direction of letting me get work done without forcing me to do it their way. That said; first it was Backbone which wasn't terrible but kinda clunky in my opinion. But then Angular came along and everybody rushed over to that pasture. But then React came along and everybody rushed over to that pasture. Now…

People and companies that can rush do rush but there are still lot's of projects where developers are using old frameworks.

Re: Introduction to Svelte

#69
post #49

Earlier quoted context omitted.

tl;dr watch this fantastic intro to svelte talk by it's creator: https://www.youtube.com/watch?v=AdNJ3fydeao , it covers some of the growing pains of React that svelte addresses. While it might look like the frontend is going around in circles, there are major & minor differences between the technologies, and they have each introduced novel (to JS at least) things... Off the top of my head (this timeline might not be…

This is literally the first time anyone has ever put together a cogent argument for why the framework du jour exists. Thank you! I still personally feel like I can usually get more done with pure Javascript but, as I said in my original post, at least they appear to be headed in a better direction. I did a project in Vue last year and it didn't entirely suck. Unlike the nightmare that was an Angular project I did two…

In an earlier comment, you said you weren't a "framework guy".

If you were you would have heard this cogent argument dozens of times already as it's fairly common knowledge to people who are into frameworks.

Consider trying to understand why frameworks are created before using them. Understanding the motivations behind a framework will help you navigate the api easily and could change your opinion about whatever frustrates you.

Post reply on HN