Loading times of vue3-sfc-loader vs. http-vue-loader -- lightweight version possible? #50
-
Hello, first of all, thank you for creating vue3-sfc-loader and http-vue-loader! Also, I am quite new to Vue.js and only have a limited understanding of how vue3-sfc-loader works, so please point out if I am making wrong assumptions somewhere. I am currently investigating if it makes sense to rely on vue3-sfc-loader for building a setup to create fast prototypes/demo apps with Vue 3. That means I do not care much about supporting older browsers and not needing a build step would be very nice. It is quite noticeable, however, that vue3-sfc-loader is considerably larger and slower than http-vue-loader. This especially gets worse when the amount of code loaded increases. I did some quick-and-dirty profiling with
I would assume that this extra overhead mostly comes from transpiling the code with Babel. With the compiledCache, it seems to be possible to reduce the extra overhead for subsequent page loads. However, I do not care about browser support and what http-vue-loader does is good enough for my purposes. Is there a way to skip transpiling and get loading speeds that are comparable to http-vue-loader? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi, I agree that The big difference between http-vue-loader and vue3-sfc-loader, it the use of
On the Note that Here are the points on which I can act to make things faster :
What i can't do :
Here are the points on which I can act to make things smaller :
|
Beta Was this translation helpful? Give feedback.
Hi,
I agree that
vue3-sfc-loader
is mush slower (and much bigger) thathttp-vue-loader
.I do my best to reduce the bundle size (but there will certainly be a limit) and to keep it fast.
The big difference between http-vue-loader and vue3-sfc-loader, it the use of
@vue/compiler-sfc
(and@vue/component-compiler-utils
for vue2) which gives much more robust results.@babel
&postcss
are certainly the most CPU consuming 3rd party libs in the process. Unfortunately they are required by@vue/compiler-sfc
for good reasons (static analysis, css modifications for scope/modules support, ...)On the
vue3-sfc-loader
side, babel is used to transpile esm to cjs, statically detect modules dependencies an…