Call Npm.require("meteor-babel") only when needed.

In practice, the non-isopacket version of meteor-babel is only used by the
shell-server package, so this saves ~200ms of reload time.
This commit is contained in:
Ben Newman
2016-10-22 19:14:08 -04:00
parent 5ae7a0954d
commit 548a288c61

View File

@@ -1,9 +1,9 @@
var meteorBabel = Npm.require('meteor-babel');
/**
* Returns a new object containing default options appropriate for
*/
function getDefaultOptions(extraFeatures) {
var meteorBabel = Npm.require('meteor-babel');
// See https://github.com/meteor/babel/blob/master/options.js for more
// information about what the default options are.
var options = meteorBabel.getDefaultOptions(extraFeatures);
@@ -22,11 +22,12 @@ Babel = {
validateExtraFeatures: Function.prototype,
compile: function (source, options) {
var meteorBabel = Npm.require('meteor-babel');
options = options || getDefaultOptions();
return meteorBabel.compile(source, options);
},
setCacheDir: function (cacheDir) {
meteorBabel.setCacheDir(cacheDir);
Npm.require('meteor-babel').setCacheDir(cacheDir);
}
};