I am embedding Vue.js into an existing application.
When initializing Vue.js like so:
new Vue({
el: "#myDomElement",
data: myData,
computed: {
price: function() {
return _this.productPrice();
},
},
created: function() { console.log("Vue created."); },
beforeCompile: function() { console.log("Vue about to compile."); },
compiled: function() { console.log("Vue compiled."); },
ready: function() { console.log("Vue ready."); },
});
I am getting a lag of about 10 seconds at this point in my code. After this delay the lifecycle hooks (created, beforeCompile etc.) all fire at once.
The delay is independent of the view, even if myDomElement is an empty div the delay occurs.
Might be relevant:
The
myDataobject is not small but not huge either (28KB when JSON.stringified)The Vue.js initialization happens in a module, that is exported via
modules.exportand then wrapped up by Webpack
new Vue({...});statement is there, the delay does not occur when this statement is removed, which indicates that Vue is at least involved in the delay.