Skip to content

Commit

Permalink
add module check to component-build(1) --standalone dance
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Nov 7, 2012
1 parent 35b894f commit a8b872f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/component-build
Expand Up @@ -93,7 +93,11 @@ builder.build(function(err, obj){
if (standalone) js.write(';(function(){\n');
js.write(obj.require);
js.write(obj.js);
if (standalone) js.write('window.' + name + ' = require("' + conf.name + '");\n');
if (standalone) js.write(' if ("undefined" == typeof module) {\n');
if (standalone) js.write(' window.' + name + ' = require("' + conf.name + '");\n');
if (standalone) js.write(' } else {\n');
if (standalone) js.write(' module.exports = require("' + conf.name + '");\n');
if (standalone) js.write(' }\n');
if (standalone) js.write('})();');

if (!program.verbose) return;
Expand Down

0 comments on commit a8b872f

Please sign in to comment.