Live data from Hacker News

Introduction to Svelte

daveceddia.com

51–60 of 116 posts

Re: Introduction to Svelte

#51
post #28

Earlier quoted context omitted.

It can matter though; fwiw. I love Rust, but my "node_modules" in Rust is absolutely huge. Not a problem on Desktop, but because I am full-time Rust these days my next laptops have to have lots of storage. Gone are the days where I can have a small SSD in my laptop. Fwiw though, even a 250MB node_modules would pale in comparison to my Rust version lol.

> I love Rust, but my "node_modules" in Rust is absolutely huge. Why does Rust need a node_modules folder?

Keats is correct - I figured this is a JS discussion thread so rather than say my target folder, I'd use "node_modules" for familiarity. I should have probably explained that. A bit of verboseness would have saved more verbose comments haha.

Re: Introduction to Svelte

#52
post #38

"Another nice thing: the node_modules folder for this Hello World Svelte app totals only 29MB and 242 packages." How is it nice that you have almost 30MB of code for something that prints "Hello World"? EDIT: For what it's worth, I don't fault Svelte for this necessarily. This is indicative of NPM bloat which is becoming rampant in my opinion.

To be fair, the Svelte bundle.js that you would actually serve to a browser is only 2.3kb. The 25mb is what the dev's computer has to store in its node_modules. "Another nice thing: the node_modules folder for this Hello World Svelte app totals only 29MB and 242 packages. Compare that to 204MB and 1017 packages for a fresh Create React App project."

A somewhat apples-to-oranges comparison I know but; 277B:

    
    
    
        Test
    
    
        
        
        document.addEventListener('DOMContentLoaded', () => document.getElementById('howdy').innerHTML = 'Hello world!')
        
    
    

Re: Introduction to Svelte

#53
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?

Re: Introduction to Svelte

#54
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…

Some people are running around to new frameworks, but most are with React. Imo Vue and Svelte are going backwards.

> Imo Vue and Svelte are going backwards

Big claims need big evidence.

Re: Introduction to Svelte

#55
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?

I never used it but I remember Angular coming with unit and e2e testing.

Re: Introduction to Svelte

#56

Earlier quoted context omitted.

Some people are running around to new frameworks, but most are with React. Imo Vue and Svelte are going backwards.

> 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.

Re: Introduction to Svelte

#57

Earlier quoted context omitted.

Some people are running around to new frameworks, but most are with React. Imo Vue and Svelte are going backwards.

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

I don't think the claim that that is his opinion is a big claim, and while it's possible that he is misrepresenting his opinion the fact they he claimed the opinion on HN with no obvious benefit from misrepresentation is itself fairly strong evidence that it is his opinion.

Re: Introduction to Svelte

#58
post #40
post #38

"Another nice thing: the node_modules folder for this Hello World Svelte app totals only 29MB and 242 packages." How is it nice that you have almost 30MB of code for something that prints "Hello World"? EDIT: For what it's worth, I don't fault Svelte for this necessarily. This is indicative of NPM bloat which is becoming rampant in my opinion.

Is it 29MB for production dependencies, or dev and prod?

Just dev. Production size is minuscule.

Re: Introduction to Svelte

#59
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…

Todo apps are used as front-end examples for the same reason the factorial function is used to explain recursion: it's simple, it's intuitive, but it exercises what you need without dragging in a lot of incidental complexity.

To demo or teach a front-end framework, you need to show:

1. How data gets rendered to the DOM

2. How collections are handled

3. How events are registered and handled

4. How the DOM is updated when data are changed

5. How form inputs are represented

The easiest thing to do is to show an array getting rendered as a list, then add click handlers which change the list somehow, which naturally segues into showing how the DOM is changed. Adding new items or deleting items also answer important questions about how exactly collections of data are mapped to collections of elements and how updates are happened. Finally, no demo of a front-end framework can be considered complete unless it addresses how form input elements work; adding functionality to add a new item or update the text of an existing item is an obvious way to demonstrate this.

Re: Introduction to Svelte

#60
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…

Oh definitely -- when you can get stuff done with pure javascript it's beautiful -- but once you notice yourself doing too much, it's time to pick one of these small frameworks.

BTW, you should check out Mithril[0], it's my current favorite, it's very small and self-contained yet very complete. It's got a slow, cautious moving community, and just enough of what you need and virtually nothing you don't -- very easy to use without bundling at all.

Also, the web components spec[1] is on the horizon and once it lands (and most frameworks support some mode where they spit out web components) we're going to get interop for free.

Also pro tip if you're going to start a new project these days and you need to get in the whole bundling swamp, use parcel. It's amazing, almost always zero config or close to it, and just works[2].

[0]: https://mithril.js.org

[1]: https://developer.mozilla.org/en-US/docs/Web/Web_Components

[2]: https://parceljs.org/

Post reply on HN