]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
gulp-umd 1819/head
authorKriss <kriss@xixs.com>
Tue, 22 Dec 2015 13:21:23 +0000 (13:21 +0000)
committerKriss <kriss@xixs.com>
Tue, 22 Dec 2015 13:21:23 +0000 (13:21 +0000)
Explicitly pass root to the factory function.

gulpfile.js

index 3eb792c4b51538012c2f0fd0d2d2a7c566c3e358..5c36138c58b624647a8aa9a8b689c9f3eb74b4b8 100644 (file)
@@ -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']
                        }