While working with babel in a node.js project, I am trying to merge all my files into a single file with transcoded and mini js.
I run babel with gulp -babel 6.1.2, I installed the ES-2015 preset (6.13.2).
I am building a package with my files and typeahead 0.11.1, the problem is that when I run the gulp task and send via babel, the type functionality does not work (Uncaught TypeError: Can not set property 'Bloodhound' from undefined). If I run the task again by removing the babel command from the pipeline line, everything will be fine.
I know that I can create two separate packages, one for my files, the other for external files, but I would like to know why it does not work.
My gulp task:
gulp.task('bundleCheckoutDesktopJs', function () {
var js = ['./src/js/project/external/*', './src/js/project/common/*', './src/js/project/*'];
return gulp.src(js)
.pipe(babel())
.pipe(concat('project.min.js'))
.pipe(uglify())
.pipe(gulp.dest('statics/js/'));
});
The results that I got after a little research (typeahead.js):
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("bloodhound", [ "jquery" ], function(a0) {
return root["Bloodhound"] = factory(a0);
});
} else if (typeof exports === "object") {
module.exports = factory(require("jquery"));
} else {
root["Bloodhound"] = factory(jQuery);
}
})
, .