Live data from Hacker News

Svelte 4

svelte.dev

191–200 of 227 posts

Re: Svelte 4

#191

Earlier quoted context omitted.

I did this - that's part of the 2nd link. Problem is that it didn't work for me. I definitely did something wrong.

Did you use the right command for your npm version? Did the installer work? Or did something go wrong with `npm run dev`?

Yes, installer worked. npm run dev resulted in a generated index.html not the contents of src/app/App.svelte

Re: Svelte 4

#192
post #50

Earlier quoted context omitted.

One of the things released today was dedicated documentation for TypeScript: https://svelte.dev/docs/typescript . The site was also updated today to include a JS/TS toggle so that you can see all the examples written in TypeScript if you prefer it to JS. I'm not sure how long ago you tried or what issues you ran into, but hopefully this will help with getting started with Svelte and TypeScript much more easily.

> The site was also updated today to include a JS/TS toggle so that you can see all the examples written in TypeScript if you prefer it to JS. Yeah that toggle has been on there for months now actually

You are thinking of the sveltekit docs not svelte docs

Re: Svelte 4

#193

Earlier quoted context omitted.

Did you use the right command for your npm version? Did the installer work? Or did something go wrong with `npm run dev`?

Yes, installer worked. npm run dev resulted in a generated index.html not the contents of src/app/App.svelte

npm run dev should start the dev server with a page that hot reloads when you make changes in the App.svelte. You selected Svelte and not Sveltekit?

I just went through it and there's an important step of changing into the directory created by `npm create ...` (named `my-svelte-app` in the example above) and then running `npm install` inside that directory.

Can confirm it works for me with npm version 8.5.5, node v15.15.0, on a macbook air with an Intel processor.

    npm create vite@latest my-svelte-app -- --template svelt
    cd my-svelte-app/
    npm install
    npm run dev
Started up the dev server, made a change in the App.svelte, and could see it reflected in the browser immediately.

Re: Svelte 4

#194

Earlier quoted context omitted.

It's the opposite for me. React can be verbose but that's because a lot of it is explicit and has escape hatches. Svelte has magic that works until it doesn't and then you're stuck in Svelte land. It's not "just JS" despite people marketing it as such

I was stuck once by abusing `bind:` and other time with global exit transitions + sveltekit routing, but that's about it. React on the other hand feels like a pot warming up and we're the frogs being boiled alive at this point. You can write some perfectly valid, but naive React code and it's going to have some footguns. We're so used to write idiomatic React code we don't even notice that anymore. You learn to use s…

Love that frog analogy.

Re: Svelte 4

#195

Time for a very naive question. As somebody looking for a more effcient (less re-rendering) and nicer DX (template based, stuff like exit animations) alternative to React, what actually makes Svelte measurably better than Vue? On first (and very naive) look the two seem pretty similar, with the biggest difference being that Vue seems to have the much bigger ecosystem and more mature tooling (I keep hearing about Svel…

> I keep hearing about Svelte's flavor of JS basically being its own language now and it not playing all that well with Typescript it's a weird habit on HN to refer to random rumours that have discouraged you from trying something, and then explicitly not link to even the source of the random thing you're thinking of. I would guess you're misremembering something about the *developers of Svelte* saying they didn't th…

[deleted]

Re: Svelte 4

#196

Time for a very naive question. As somebody looking for a more effcient (less re-rendering) and nicer DX (template based, stuff like exit animations) alternative to React, what actually makes Svelte measurably better than Vue? On first (and very naive) look the two seem pretty similar, with the biggest difference being that Vue seems to have the much bigger ecosystem and more mature tooling (I keep hearing about Svel…

> especially since Vue already uses a "compiler informed virtual DOM"

Not diffing at all against a virtual DOM and instead executing the pre-compiled DOM manipulations is an order of magnitude better in terms of processing. It also avoids diffing entirely. At a casual glance, the compiler hints and other VDOM optimisations in Vue reduce but do not obviate this burden (e.g., don't re-render static nodes, flatten the DOM tree to avoid traversing) But as ever, it's best to measure these things and I can't seem to find any recent benchmarks between the two platforms, and any benchmark would vary wildly depending on use-case, and with the exigencies of real-world development.

Re: Svelte 4

#197

Earlier quoted context omitted.

Vue dropped "reactivity transform" but they are working on a new "Vapor Mode" which is inspired by SolidJS, i.e. not having a VDOM. https://blog.vuejs.org/posts/2022-year-in-review

Thanks for the link! > Vapor Mode will only support a subset of Vue features. In particular, Vapor Mode components will only support Composition API and . However, this supported subset will work exactly the same between Vapor and non-Vapor components. > Building an app with only Vapor components allows you to drop the Virtual DOM runtime from the bundle, significantly reducing the baseline runtime size. This seems l…

That's super exciting news, i only use composition API and script setup with Vue anyway!

Re: Svelte 4

#198

Earlier quoted context omitted.

Really? Feature realease v3.3 was released just last month... https://blog.vuejs.org/posts/vue-3-3

Look at the GitHub commits in the 6 months before 3.3

What I like about Vue is less churn. Vue stayed in 2.6 for a long long time. It's fine.

Re: Svelte 4

#199
One of the platforms I built before used jquery and bootstrap, while it obviously do the job but I was looking to revamp the whole UI, svelte was one of the options as it’s close to vanilla js, react is troublesome unless you enjoy your app breaks next time you update it. The only thing I’m looking for, is there any component based svelte UI I can choose from and quickly build my UI, similar to bootstrap if that make sense, as I usually do embedded development and last thing I want is to work wuth css.

To be more exact on what I want to do: is a dynamic dashboard, where users can add widgets or/and resize them per needed.

Re: Svelte 4

#200
post #84
post #4

> Svelte 4 reduces the Svelte package size by nearly 75% (10.6 MB down to 2.8 MB), which means less waiting on npm install. This improvement will be especially noticeable for users who are loading our interactive learning experience on learn.svelte.dev for the first time, users of the Svelte REPL, and users with limited connectivity. The majority of the remaining package size is eslint support, which necessitates dis…

I remember when I was talking about some code my team wrote once and we'd managed to get an operation down from 6 hours to like 5 minutes. Another manager said to me (fairly with hindsight) "If you get something down from two hours to one hour, that's an opimisation. Going from 6 hours to 5 minutes means it just wasn't finished."

I hope you glared at him and said "do I need to optimize your ass with my foot?"

Sorry, HR rep, I thought we were just slinging pithy aphorisms!

Post reply on HN