Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version breaks with RequireJS (global is undefined) #1004

Closed
boskee opened this issue Apr 20, 2015 · 2 comments
Closed

Latest version breaks with RequireJS (global is undefined) #1004

boskee opened this issue Apr 20, 2015 · 2 comments

Comments

@boskee
Copy link

boskee commented Apr 20, 2015

Hello,

It looks like the latest version breaks when used with RequireJS (specifically handlebars.amd.js and handlebars.amd.min.js)

The problem exists in the following piece of code (starting at line 3859 in handlebars.amd.js):

  var $Handlebars = global.Handlebars;
  /* istanbul ignore next */
  inst.noConflict = function () {
    if (global.Handlebars === inst) {
      global.Handlebars = $Handlebars;
    }
  };

And it can be fixed by using the snippet starting at line 724 of the same file:

  var root = typeof global !== 'undefined' ? global : window,
      $Handlebars = root.Handlebars;
  /* istanbul ignore next */
  Handlebars.noConflict = function () {
    if (root.Handlebars === Handlebars) {
      root.Handlebars = $Handlebars;
    }
  };

So the code in question should become:

  var root = typeof global !== 'undefined' ? global : window,
      $Handlebars = root.Handlebars;
  /* istanbul ignore next */
  inst.noConflict = function () {
    if (root.Handlebars === inst) {
      root.Handlebars = $Handlebars;
    }
  };
@kpdecker
Copy link
Collaborator

Sorry for this. This is a pretty simple fix and I hope to release a patch for this soon.

@kpdecker
Copy link
Collaborator

Released in 3.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants