diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -29,8 +29,8 @@ module.exports = function(grunt) {
                     // Avoid breaking semicolons inserted by r.js
                     skipSemiColonInsertion: true,
                     wrap: {
-                        start: headerComment + "(function() {\n    \"use strict\";\n",
-                        end: "}());"
+                        start: headerComment + "(function(window) {\n    \"use strict\";\n",
+                        end: "}(typeof window !== 'undefined' ? window : this));"
                     },
                     rawText: {},
                     onBuildWrite: convert
Fixed issue with `window` not being defined