deepak1556 / gulp-browserify

Bundle modules with BrowserifyJS
MIT License
195 stars 45 forks source link

'module' is undefined in browserify_shim__define__module__export__ #68

Open vmalloc opened 10 years ago

vmalloc commented 10 years ago

I tried using the gulp template from https://gist.github.com/simme/8931006. The resulting templates.js file contains this:

(function browserifyShim(module, exports, define, browserify_shim__define__module__export__) {

; global.Handlebars = require("handlebars");
module.exports = Ember.TEMPLATES["index"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
  data.buffer.push("THIS IS A TEMPLATE!");

});
; browserify_shim__define__module__export__(typeof Ember.TEMPLATES != "undefined" ? Ember.TEMPLATES : window.Ember.TEMPLATES);

}).call(global, undefined, undefined, undefined, function defineExport(ex) { module.exports = ex; });

There is no way this code can execute without error, if I'm reading it correctly, and indeed it fails because it tries to set 'exports' on module, which is undefined. Is this a bug or am I missing something?