Live data from Hacker News

Migrating from Vue 2 to Svelte

escape.tech

11–20 of 289 posts

Re: Migrating from Vue 2 to Svelte

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

I know you're probably asking it only rhetorically, but it's the way to mark something as reactive for the Svelte "compiler", cleverly using the existing JS label syntax.[1] [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

"cleverly"

Re: Migrating from Vue 2 to Svelte

#12

Re events - You can type events in Vue with `defineEmits`: https://vuejs.org/api/sfc-script-setup.html#defineprops-defi... Re global enums - I'm not sure what the author means about global enums - anything imported into your Vue file can be used in the ` `. Re styles - Style is automatically scoped in Vue SFC files, too - I believe it was the first component framework to do this. This article and migration seems not…

I've got a couple of templates where I've aliased the value of a TypeScript enum into a local variable before using it in the template, so I'm pretty certain at that point I was unable to use the value of the enum directly (that's also how I remember it). However, I just tried it and...it seems to just work now. So thanks for making me revisit that :D.

Re: Migrating from Vue 2 to Svelte

#14

Re events - You can type events in Vue with `defineEmits`: https://vuejs.org/api/sfc-script-setup.html#defineprops-defi... Re global enums - I'm not sure what the author means about global enums - anything imported into your Vue file can be used in the ` `. Re styles - Style is automatically scoped in Vue SFC files, too - I believe it was the first component framework to do this. This article and migration seems not…

edit: Disregard, this is wrong.

-----

I agree with the rest, but how do you use imported TS enums in your template? Something like this being impossible is regularly a pain point for me:

    slotProps.data.type === ArticleTypes.SomeType

Re: Migrating from Vue 2 to Svelte

#16
post #4

It seems worrisome that front end frameworks needs to be changed after just two years of use. Glad I'm not working with front end...

As another comment mentioned, migrating from Vue 2 to Vue 3 is mostly trivial, so this is probably just a case of preferring the new shiny over the old formerly shiny now slightly tarnished...

Re: Migrating from Vue 2 to Svelte

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

At least it was on top within the timeline-strings-percentage-bubbles graphic.

And as the latest and greatest omnipotent entry in it, so my guess would be theirs authors were aware of it.

/edit: thanks for pointing me to solid, it shined a lot of light to me in context of the article.

Re: Migrating from Vue 2 to Svelte

#18
Has anyone worked on a very large Svelte project yet? I work on a large React app in real life, but have been learning Svelte in my off time - there are some nice aspects like the out of the box state management, the syntax and structure is a bit easier to learn than React, but my intuition is a Svelte project would become unwieldy for a very complex app (React class components that are hundreds of lines long with dozens of props/local states are easy for me to read/digest but maybe I'm just used to it, it just doesn't feel to me like this would stay well organized in a .svelte file).

Re: Migrating from Vue 2 to Svelte

#19
post #4

It seems worrisome that front end frameworks needs to be changed after just two years of use. Glad I'm not working with front end...

I see it as more a lack of developer discipline than a need—or, more charitably, developers choosing to prioritize things other than longevity. You can certainly choose to develop in a way that's more stable.

Re: Migrating from Vue 2 to Svelte

#20
post #18

Has anyone worked on a very large Svelte project yet? I work on a large React app in real life, but have been learning Svelte in my off time - there are some nice aspects like the out of the box state management, the syntax and structure is a bit easier to learn than React, but my intuition is a Svelte project would become unwieldy for a very complex app (React class components that are hundreds of lines long with do…

Not sure if this satisfies your question, but I'm the creator of the Skeleton UI library: https://github.com/skeletonlabs/skeleton

Our documentation is all Svelte and dogfoods our own UI components. We've got dozens of pages and components here. Scale is from small to large. All open source so give it a go.

I come from a background in Angular over the last 10 years. Built several large SaaS apps and admin systems. I'd have no hesitation using Svelte in it's stead. In fact I'd probably get it done in half the time and half the code.

Post reply on HN