Vue: Vue and Svelte

Created on 16 Dec 2016  ·  1Comment  ·  Source: vuejs/vue

Would be great if Vue could be somehow like sveltejs is...

Not having Vue and all its core bits and pieces bundled in my app but instead containing just what i use. their syntax and way of working reminds me the exactly workflow of using vue with webpack and .vue files (example)

Maybe their concept is just to new... but it makes completely sense. when i use vue what deep inside i am looking for is a light eight library that doesn't add weight to my code... so i see its very easy to make a framework on top of vue and dont have this feeling of like (adding jquery just to use $('element') instead of document.querySelector) I don't know what u guys think about this. but if vue could be splited at compile time instead of using it as a whole library would add a great booooost on everything.

Most helpful comment

Well, this is not gonna happen for two reasons:

  1. Svelte's compilation strategy is incompatible with the Virtual DOM. It compiles templates down to imperative DOM operations, which means you must use templates. But in Vue 2, users can write render functions, which cannot be compiled in the same fashion because render functions are purely dynamic and very difficult to statically analyze.

  2. Vue is already light (17kb gzipped) and Svelte isn't really zero runtime. In addition, Svelte's generated code is much more verbose than Vue's generated render functions. For each component of the same complexity in a project, Svelte's generated code is going to be a bit heavier than Vue's, and this adds up when your project gets bigger. The eventual size difference simply isn't significant enough to justify the loss of render functions. There isn't such a "great booooost" so to speak.

>All comments

Well, this is not gonna happen for two reasons:

  1. Svelte's compilation strategy is incompatible with the Virtual DOM. It compiles templates down to imperative DOM operations, which means you must use templates. But in Vue 2, users can write render functions, which cannot be compiled in the same fashion because render functions are purely dynamic and very difficult to statically analyze.

  2. Vue is already light (17kb gzipped) and Svelte isn't really zero runtime. In addition, Svelte's generated code is much more verbose than Vue's generated render functions. For each component of the same complexity in a project, Svelte's generated code is going to be a bit heavier than Vue's, and this adds up when your project gets bigger. The eventual size difference simply isn't significant enough to justify the loss of render functions. There isn't such a "great booooost" so to speak.

Was this page helpful?
0 / 5 - 0 ratings