vue3-sfc-loader
vue3-sfc-loader copied to clipboard
Slow parsing?
First of all, great work!
But I tested the load-from-string example and the timing is just bad for production. It takes ~70ms to create the component from a simple string. I don't assume the problem is the content, since there is nothing great to parse.
So is it the invocation of the parser itself? Doing unnecessary steps or are the functions so big it takes so much time to load it? Can this be optimized?
const options = {
moduleCache: {
vue: Vue,
},
getFile() {
return `<template>nothing</template>`
},
addStyle() { }
}
let begin = (new Date).getTime()
loadModule("foo.vue", options).then(() => {
const elapsed = (new Date).getTime() - begin
console.log("component created after " + elapsed + " ms")
})
Hi webloft,
try to enable "compiledCache" :
const options = {
...
compiledCache: {
get: key => window.localStorage.getItem(key),
set: (key, value) => window.localStorage.setItem(key, value),
},
...
}
see also https://github.com/FranckFreiburger/vue3-sfc-loader/discussions/175