title: Include jQuery UI with requireJS using noConflict jQuery
body: <p>I'm working on a JavaScript module that uses jQuery, some functions of jQuery UI (draggable) and jPlayer. Recently I made myself familiar with requireJS to manage the dependencies properly.</p>
  
  <p>I don't want to produce conflicts with a possibly already existing jQuery version that the site that includes my script uses. For this reason I am mapping the jQuery dependencies to a module "jquery-private" with a call of noConflict(), as is described in the requireJS <a href="http://requirejs.org/docs/jquery.html" rel="nofollow noreferrer">guide</a>.</p>
  
  <p>As jQuery UI takes up a lot of space, I would also like to just include the modules that I am actually using. ui.draggable has the dependencies ui.core, ui.mouse and ui.widget, so I should have to include these 4 modules.</p>
  
  <p>My problem is that I would like the jQuery UI modules and the jPlayer module to use my own version of jQuery, but obviously it isn't accessible by the global $ variable after I called the noConflict() method. Unfortunately neither jQuery UI nor jPlayer are AMD modules, so I needed to make shim configurations for them.</p>
  
  <p>Here is my definition of the dependencies:</p>
  
  <pre><code>require.config({
      baseUrl: 'javascript/modules',
      paths: {
          jquery: 'jquery-2.1.3',
          jPlayer: 'jquery.jplayer',
          uiCore: 'jquery.ui.core',
          uiMouse: 'jquery.ui.mouse',
          uiWidget: 'jquery.ui.widget',
          uiDraggable: 'jquery.ui.draggable'
      },
      map: {
        // '*' means all modules will get 'jquery-private'
        // for their 'jquery' dependency.
        '*': { 'jquery': 'jquery-private' },
  
        // 'jquery-private' wants the real jQuery module
        // though. If this line was not here, there would
        // be an unresolvable cyclic dependency.
        'jquery-private': { 'jquery': 'jquery' }
      },
      shim: {
          jPlayer: {
              deps: ['jquery']
          },
          uiCore: {
              deps: ['jquery']
          },
          uiMouse: {
              deps: ['jquery','uiCore']
          },
          uiWidget: {
              deps: ['jquery','uiCore']
          },
          uiDraggable: {
              deps: ['jquery','uiCore','uiMouse','uiWidget']
          }
      }
  });
  
  require(["json","jquery","jPlayer","uiDraggable"], function(json,___jQuery,jplayer,uiDraggable) {
      (...)
  }
  </code></pre>
  
  <p>Obviously this code produces errors as the $ variable in the jQuery UI modules is not defined.</p>
  
  <p>Is there any way to pass my own jQuery object to modules? The top answer in another thread (<a href="https://stackoverflow.com/questions/15901731/how-use-require-js-to-load-jquery-with-noconflict">How use require.js to load jQuery with noConflict</a>) suggests that what I am trying to do is not possible, but maybe there is some other way to do it?</p>
  
  <p>If there is none, I probably have to use global variables and heavily edit the included modules, which kind of makes it questionnable why to use a dependency management library like requireJS in the first place...</p>