-
-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Here's my simple module (named module1.js)
var someVar = 1; export default {someVar};
I have a grunt task as below,
babel: { files: { expand: true, src: ['src/*.js'], dest: 'dist/' }, options: { sourceMap: true, presets: ['env'] } }
This transpiles module1.js as,
`(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.undefined = mod.exports;
}
})(this, function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var someVar = 1;
exports.default = {
someVar: someVar
};
});
//# sourceMappingURL=module1.js.map`
Actual behavior: Note the highlighted code in above output
Expected behavior: It should be the module name instead of undefined i.e.
global.module1 = mod.exports;
Note: This works fine when I run it through cmd as,
$ babel src/module1.js --out-file dist/module1.js