You missed what is great about Meteor 1.5, check out Ben’s blog entry.
Summary: Meteor supports dynamically importing modules at runtime. This reduces initial download package and can spread the download time across your app if used appropriately. As Ben explains, there are few compromises with the Meteor solution which I think really sets it apart.
I’m not using Vue, but I don’t see why it wouldn’t work. My code looks like
Template.pwdStrengthBubble.events({
'input #at-field-password': function(event, template) {
import("zxcvbn").then(zxcvbn => {
...
const result = zxcvbn.default(password, user_inputs=['correcthorsebatterstaple']);
if (result.score == 0) {
template.strength.set(result.score+1);
} else {
template.strength.set(result.score);
}
template.reason.set(result.feedback.warning);
}
}); // End of import
}
}); // End events
The zxcvbn NPM is over 400k in size and is only needed when creating an account so dynamically loading it only when needed shaves over 400k from my bundle size. This doesn’t mean much when running on a corporate network, but if you are on the typical ATT or Comcast connection, the difference is noticeable. Dynamic loading is probably the best thing in 1.5
I also read the modules documentation, only to see that conditional imports cannot work, only require can work in an if statement. (except by using the 2 snippets above).
Am I missing something ? If so maybe the docs need to be updated !