From 1221d8311acd5f2f53332ded1a62669e2ab0dcde Mon Sep 17 00:00:00 2001 From: Kriss Date: Tue, 22 Dec 2015 13:21:23 +0000 Subject: [PATCH] gulp-umd Explicitly pass root to the factory function. --- gulpfile.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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'] } -- 2.47.2