Live data from Hacker News

Migrating from Vue 2 to Svelte

escape.tech

41–50 of 289 posts

Re: Migrating from Vue 2 to Svelte

#41
post #2

Migrating from svelte to when

Meanwhile React will continue succeeding the test of time

I learned React almost a decade ago and never looked back. Multiple SaaS apps and dozens of personal projects later, I feel no need to reach for anything else.

Re: Migrating from Vue 2 to Svelte

#42
post #36

I'm missing the raw numbers. Increased performance? Faster code execution? By how much? I'm sure Svelte is faster, but if we're talking 10% improvement it doesn't really matter. Additionally... {@html Prism.highlight(code, Prism.languages[lang], lang) } looks very unsafe to me. (Vue example has the exact same problem)

i dont understand, you’d have to do the same in react?

mostly this code injection comes from trusted sources like your CMS. if you’re displaying arbitrary user input then yeah better sanitize it but thats a problem common to all frameworks react included

as for perf i mean the main thing is “are you downloading 100kb just for the framework” whereas many svelte apps come in under 10kb. beyond that agree it doesnt really matter

Re: Migrating from Vue 2 to Svelte

#43
post #25

One huge thing that I feel nobody talks about about Svelte is that there is no easy way to pass components as props. Sure, there is slots and svelte:component but the ergonomics just don't match.

deleted: misread comment

They weren't talking about web components.

Re: Migrating from Vue 2 to Svelte

#44
post #28

Earlier quoted context omitted.

what do you like about the dev experience? i have a hard time seeing solid as something more than “react but faster and slightly less annoying”. still doesnt have scoped styles, animation, state mgmt, head management, etc out of the box, all minimum things i look for to be productive

They recently released a beta of SolidStart, their answer to Next.js/SvelteKit/Remix, etc, and I’ve been really liking it. A lot of good ideas pulled from the other frameworks. https://www.solidjs.com/blog/introducing-solidstart

cool. any blessed scoped styling solution or is it the usual wild west?

Re: Migrating from Vue 2 to Svelte

#45
post #44

Earlier quoted context omitted.

They recently released a beta of SolidStart, their answer to Next.js/SvelteKit/Remix, etc, and I’ve been really liking it. A lot of good ideas pulled from the other frameworks. https://www.solidjs.com/blog/introducing-solidstart

cool. any blessed scoped styling solution or is it the usual wild west?

wild west? as far as CSS is concerned the cascade should be well known and for scoping its (in order of preference):

1. user 2. client 3. document

and within document its in "components", but those are unknown from the start so we defer the details (which must not but can lead to "wild west"). programming is hard, thought. would love to have that holy grail solved, too (apart from the famous three column layout).

Re: Migrating from Vue 2 to Svelte

#46
post #28
post #13

Solid JS is what I would have chosen. Not sure if they considered it. Best performance and dev experience with least 'magic' of all frameworks I've tried.

what do you like about the dev experience? i have a hard time seeing solid as something more than “react but faster and slightly less annoying”. still doesnt have scoped styles, animation, state mgmt, head management, etc out of the box, all minimum things i look for to be productive

> i have a hard time seeing solid as something more than “react but faster and slightly less annoying”.

Err, I'd have a hard time not to see that as a major benefit first of all?

Re: Migrating from Vue 2 to Svelte

#47

I’ve been so happy with Vue (2 or 3), I can’t think of a compelling reason to leave. The 2->3 migration is also trivial aside from any third party libs that don’t work. It’s really not a big lift. You can transition without going all-in on the composition API. The diff on a big project is very small.

Trivial is not the word I would use. My 2 -> 3 migration is a currently ongoing nightmare, even with the compat lib. I was using vue-class-component with typescript, which apparently... just doesn't work at all with Vue 3? And this isn't really documented, so I basically spent today digging around in Vue's guts with the debugger to prove there was no good way to salvage it for my code, I really just needed to rip it out to have a chance of running it at all. Hopefully that was the worst of it, but Vuex is still acting up. Thank god for VCS or this would be terrifying.

Re: Migrating from Vue 2 to Svelte

#48
post #7

Still don't understand why people prefer magic templated front-end frameworks. Reading non-standard HTML just sucks. What even is "$:" or why does Vue require non-standard javascript ref("") objects...

Because writing code declaratively it's much more readable than imperatively. {name} clearly state that you want name inside h1, it's colocated and faster to write than const h1=document.querySelector("h1"); h1.innerText=name; As for why we need $ or reactive is because JavaScript does not comes with a way to express reactivity. In the case of svelte this means having to come up with a syntax for the compiled languag…

> > Reading non-standard HTML just sucks

> it's much more readable

I guess this is just a difference in opinion then, haha. Not so different from Python vs Ruby.

If we talk about bundle size, then there might be more interesting discussion. Svelte claims to be pretty small - I wonder how that pans out compared to an "equivalent" app in Vue or even vanilla JS.

Re: Migrating from Vue 2 to Svelte

#50
The very first paragraph leads me to believe this is just a rewrite into svelte for the sake of it - I get it, Svelte is the new hotness on the FE-js-block, but this entire post stinks of "someone on the dev team advocated and fluffed enough figures to convince us. So now we're going to tell you why it was the right choice!" I say all this pretty confidently as someone currently maintaining a massive legacy vue2 app which we are currently rewriting into... *checks notes* React. Because we thoroughly vetted and PoC'd how we'd do it in Svelte and in Vue 3. The former is utterly untenable for an actual product-serving business - it is a pre-release, actively-developing product. Vue 3 is great, I highly recommend reacty-folks or frontend devs try it. We wanted the larger ecosystem (and boo to us for not being brave enough to support the growing vuecosystem).

The framework is so new, trying to justify your decision based on State of JS surveys over the last three years is asinine at best - svelte's own UI framework[1] is not even at 1.0 (has only recently been renamed to sveltekit).

Furthermore, there's a literal migration guide[2] to bring your app from vue 2 to 3. It's not easy. It's not painless. But being on vue 2 is equally painful. I'm also not sure what documentation or development this person is referring to because "restricted global access" is just patently false for both vue 2 and 3 - I don't even know what to cite here because it boggles my mind so thoroughly that I can't even conceive where you would come up with that "fact." Is this someone who's never opened their root app file? The place where one can pipe anything from decorators (and yes, enums???) to entire packages globally?

[1] https://kit.svelte.dev [2] https://v3-migration.vuejs.org/

Post reply on HN