Live data from Hacker News

Migrating from Vue 2 to Svelte

escape.tech

61–70 of 289 posts

Re: Migrating from Vue 2 to Svelte

#61

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

`ArticleTypes` should be automatically available in the template just from importing it if you use script setup

Otherwise you also need to return it in the setup function (composition) or store a local copy of it in the data field (options)

Re: Migrating from Vue 2 to Svelte

#62
As an infrastructure engineer who sometimes try to write good looking UI for internal dashboards,

I don't see much difference between the two. So why not go with the largest community?

Re: Migrating from Vue 2 to Svelte

#63
Particularly saddened they didn't chose web components.

After 25+ years of HTML, JS, CSS, the switch to TS, WebComponent(lit) and Tailwind in Vite is like sci-fi for me.

But let's discuss this again when escapy.js the library, that does not exist yet, will replace svelte in 5 years

Re: Migrating from Vue 2 to Svelte

#64
JavaScript framework fence sitters who are planning to use Svelte for a component in your SSR application please note that that their Web Components support is very buggy and Svelte team has no intention to fix it, Because(In their own words)[1] -

"Nobody on the core maintainers team is particularly fond of Web Components"

Yet,Their official doc includes support for Custom Elements; I found that svelte is not the right JS framework for building specific components in a SSR app while trying to use it for feature in my Go application[2].

[1] https://github.com/sveltejs/svelte/issues/6481

[2] https://abishekmuthian.com/javascript-framework-fence-sitter...

Re: Migrating from Vue 2 to Svelte

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

We built Roomlio entirely with svelte. Large app and many components. Having used react and angular on production apps in the past, I much prefer svelte. That being said, I am sick of framework fatigue and going forward I would probably choose raw web components and a simple template literal based template library like lit-html (not lit element). Write all the other bits ourselves.

Re: Migrating from Vue 2 to Svelte

#67

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…

I was in a similar situation, heavy class component based TypeScript Vue 2 project. Vetur was still the default vscode extension and slow. It was either a big rewrite to Vue 3 or a big rewrite to React for me. I switched to React+MobX and have no regrets.

Re: Migrating from Vue 2 to Svelte

#68
Since i first stumbled upon Quasar(built on vue 3) last year, i have never looked back. It is all that I ever wanted and could never find. And with pinia instead of vuex it's all even simpler. Vue isn't going anywhere and neither am i.

Re: Migrating from Vue 2 to Svelte

#69

Does anyone use svelte for large scale applications? I'm wondering what the advantage is over other libraries

For me, DX.

I'm writing a dashboard UI for a project as well as the marketing site, both in SvelteKit. It's so easy to write semantic HTML and I'm not forced to see divs everywhere (this has apparently been fixed in React). The reactivity bits are great. It's also lightweight.

I've already seen comments here basically saying, "Yeah cool, React is here to stay" and that's fine. Y'all use that.

Svelte is easy to pick up and a joy to use.

Re: Migrating from Vue 2 to Svelte

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

There’s a very complex open source low code project called Budibase that you can look at: https://github.com/Budibase/budibase
Post reply on HN