Permalink
Browse files

declare a global `require` for dojo

when dojo 1.7's "main module" (dojo/main.js) is loaded, it loads dojo/_base/browser which fails if there's no global `require`
  • Loading branch information...
1 parent 5077d8a commit af1db3f8ec0f94ce01d5d796141e1d448de04b53 John Hann committed Apr 9, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/curl/shim/dojo16.js
@@ -20,6 +20,7 @@
* });
*
*/
+var require;
define(/*=='curl/shim/dojo16',==*/ ['curl/_privileged', 'curl/domReady'], function (priv, domReady) {
"use strict";
@@ -45,6 +46,11 @@ define(/*=='curl/shim/dojo16',==*/ ['curl/_privileged', 'curl/domReady'], functi
// as a dependency
duckPunchRequire(_curl);
+ // dojo 1.7 still expects a global `require`, so make sure they've got one
+ if (typeof require == 'undefined') {
+ require = _curl;
+ }
+
// override executeDefFunc to override "require" deps
priv['core'].executeDefFunc = function (def) {
duckPunchRequire(def.require);

0 comments on commit af1db3f

Please sign in to comment.