From: Kriss Date: Tue, 22 Dec 2015 13:21:23 +0000 (+0000) Subject: gulp-umd X-Git-Tag: 2.0.0-beta2~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1819%2Fhead;p=thirdparty%2FChart.js.git gulp-umd Explicitly pass root to the factory function. --- diff --git a/gulpfile.js b/gulpfile.js index 3eb792c4b..5c36138c5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -75,7 +75,19 @@ function buildTask() { .pipe(replace('{{ version }}', package.version)) .pipe(umd({ // We want a global always to ensure that we match previous behaviour - templateName: 'returnExportsGlobal', + templateSource: + ";(function(root, factory) {\n"+ + " if (typeof define === 'function' && define.amd) {\n"+ + " define(<%= amd %>, factory);\n"+ + " } else if (typeof exports === 'object') {\n"+ + " module.exports = factory.call(root,<%= cjs %>);\n"+ + " } else {\n"+ + " root.<%= namespace %> = factory.call(root,<%= global %>);\n"+ + " }\n"+ + "}(this, function(<%= param %>) {\n"+ + "<%= contents %>\n"+ + "return <%= exports %>;\n"+ + "}));\n", dependencies: function() { return ['moment'] }