title: Correct way of loading non-AMD compatible jQuery plugins in require.js with jQuery in noConflict mode?
body: <p>Say I want to use jquery together with a standard, non-amd enabled jquery plugin that has been defined using standard closure: <code>(function($))( $.fn.myplugin = { ... } )(jQuery);</code> and it all sits inside of a <code>js/libs/jquery/jquery.myplugin.js</code>.</p>
  
  <p>I use this config:</p>
  
  <pre><code>require.config({
    baseUrl: 'js/',
    paths: {
      'jquery':          'libs/jquery/jquery-noconflict', 
      'underscore':      'libs/underscore/underscore',
      'backbone':        'libs/backbone/backbone',
      'jquery-myplugin': 'libs/jquery/jquery.myplugin'
    },
    shim: {
      'backbone': {
        deps: ['underscore', 'jquery'],
        exports: 'Backbone'
    },
    'jquery-myplugin': {
      deps:  ['jquery'] 
    }
  });
  </code></pre>
  
  <p>I load jQuery in no-conflict mode in <code>libs/jquery/jquery-noconflict.js</code>, becase I don't want to pollute global namespace:</p>
  
  <pre><code>define(['libs/jquery'], function () {
    return jQuery.noConflict(true);
  });
  </code></pre>
  
  <p>and this is how I load my main app.js:</p>
  
  <pre><code>define([
    'jquery',
    'underscore',
    'backbone',
    'jquery-myplugin'],
  function($, _, Backbone, MyPlugin){
    //MyPlugin is always undefined, not even sure if 
    //I should be passing it here if it only extends jQuery?
  });
  </code></pre>
  
  <p>Now, here is the problem I am experiencing - while I can use all libraries defined above without any problems, I could not work out the correct <code>shim</code> configuration to load non-AMD enabled jquery plugins.</p>
  
  <p>I've tried setting up <code>jquery-myplugin</code> as <code>deps</code> of the <code>jquery</code> (and other way around) but I could never get it working.</p>
  
  <p>It seems like I'm having problem with the following scenario:</p>
  
  <ol>
  <li>jQuery loads in no-conflict mode.</li>
  <li>plugin code runs, extending the instance of the jQuery above</li>
  <li>I can use $ within my application, extended by the plugin code, so $.myplugin is available.</li>
  </ol>
  
  <p>I have seen similar questions floating around but none of them actually resolves this issue giving only vague suggestions such as "use shim config"...</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I also tried using </p>
  
  <pre><code>"jquery-myplugin": {
      deps: ["jquery"],
      exports: "jQuery.fn.myplugin"
  }
  </code></pre>
  
  <p>And whilst plugin methods are available once loaded as AMD module this way, I still can't access: <code>$('.class').myplugin()</code> as default $ object hasn't been extended with myplugin code.</p>