diff --git a/lib/global_amd.js b/lib/global_amd.js index 8e70dfe..b2aab6b 100644 --- a/lib/global_amd.js +++ b/lib/global_amd.js @@ -32,12 +32,12 @@ module.exports = function(load){ " });\n" + " var define = loader.global.define;\n" + " var require = loader.global.require;\n" + - " var source = \"" + source + "\";\n" + + " var source = \"" + (metadata.exports ? (source + 'this[\'' + metadata.exports + '\'] = ' + metadata.exports) : source) + "\";\n" + (metadata.init ? " var init = " + metadata.init.toString() + ";\n" : "") + " loader.global.define = undefined;\n" + " loader.global.module = undefined;\n" + " loader.global.exports = undefined;\n" + - " loader.__exec({'source': source, 'address': module.uri});\n" + + " loader.__exec({'source': source, 'address': module.uri, 'metadata': {'eval': '" + (metadata.eval || '') + "'} });\n" + " loader.global.require = require;\n" + " loader.global.define = define;\n" + "\n return loader.get(\"@@global-helpers\").retrieveGlobal(module.id, " +