title: How can I work around Handlebars.js lack of a noConflict method?
body: <p>I'm creating a web application using Backbone.js and Handlebars.js (with Underscore.js and jQuery as dependencies for Backbone). I'm loading modules for the app with requirejs.</p>
  
  <p>Following the instructions here:</p>
  
  <p><a href="http://requirejs.org/docs/jquery.html#noconflictmap" rel="nofollow">http://requirejs.org/docs/jquery.html#noconflictmap</a></p>
  
  <p>and here:</p>
  
  <p><a href="http://requirejs.org/docs/api.html#config" rel="nofollow">http://requirejs.org/docs/api.html#config</a></p>
  
  <p>So my requirejs config looks like:</p>
  
  <pre><code>  map: {
      '*' : { 'jquery': 'jquery-private' },
      'jquery-private': { 'jquery': 'jquery' }
    },
    shim: {
      'underscore' : {
        exports: '_',
        init: function() { return this._.noConflict(); }
      },
      'backbone'   : {
        deps: ['underscore', 'jquery'],
        exports: 'Backbone',
        init: function(_, $) {
          // need to manually set Backbone.$ since it looks for it on the global object
          this.Backbone.$ = $;
          return this.Backbone.noConflict();
        }
      },
      'handlebars' : { exports: 'Handlebars' }
    }
  </code></pre>
  
  <p>I'm loading local copies of my dependencies by calling <code>noConflict()</code> on backbone, underscore, and jquery. However, Handlebars does not have a <code>noConflict</code> method; if I attempt to configure the shim for it in the same way as backbone &amp; underscore, I get an error:</p>
  
  <p><code>Uncaught TypeError: Object #&lt;c&gt; has no method 'noConflict'</code></p>
  
  <p>No real surprise there, but then I'm concerned about conflicts! Is there a workaround? Can I somehow manually achieve the same goal by writing my own version of the <code>noConflict</code> for Handlebars? What would that look like?</p>