title: Unable to load jQuery plugins when using requirejs & r.js optimizer
body: <p>I'm having a bit of trouble with my the requirejs optimizer. After I run the optimizer, I get a few error messages in my build/compiled file. When running my web application without the optimize step I do not have any errors.</p>
  
  <p>This is my client.js file (contains config) (coffeescript)</p>
  
  <pre><code>requirejs.config
    baseUrl: '/source/'
    paths:
      text:                 'lib/text'
      io:                   'lib/socket.io'
      underscore:           'lib/underscore'
      backbone:             'lib/backbone'
      jquery:               'lib/jquery'
  #    almond:               'lib/almond'
      bootstrap:            'lib/bootstrap'
      bootstrapFileUpload:  'lib/bootstrap-fileupload'
      jqueryUniform:        'lib/jquery.uniform'
      jqueryBrowser:        'lib/jquery.browser'
      datatables:           'lib/jquery.dataTables'
      datatables_bootstrap: 'lib/DT_bootstrap'
    shim:
      io:
        exports: 'io'
      jquery:
        exports: 'jQuery'
      jqueryBrowser:
        deps:    ['jquery']
      jqueryUniform:
        deps:    ['jqueryBrowser', 'jquery']
      underscore:
        exports: '_'
      backbone:
        deps:    ['underscore', 'jquery']
        exports: 'Backbone'
      datatables_bootstrap:
        deps:    ['jquery', 'datatables']
      datatables:
        deps:    ['jquery']
  
  
  require ['routers/router', 'backbone'], (Router, Backbone) -&gt;
    MainRouter = new Router()
    Backbone.history.start()
  </code></pre>
  
  <p>And here is my config for the optimizer. I run the optimizer from nodejs after requiring 'requirejs' as a module.</p>
  
  <pre><code>  config =
      baseUrl: __dirname + '/../client/source'
      name:    'lib/almond'
      include: './client'
      optimize: 'none'
      out:     __dirname + '/../client/' + hash + '.js'
      paths:
        text:                 'lib/text'
        io:                   'lib/socket.io'
        underscore:           'lib/underscore'
        backbone:             'lib/backbone'
        jquery:               'lib/jquery'
        bootstrap:            'lib/bootstrap'
        bootstrapFileUpload:  'lib/bootstrap-fileupload'
        jqueryUniform:        'lib/jquery.uniform'
        jqueryBrowser:        'lib/jquery.browser'
        datatables:           'lib/jquery.dataTables'
        datatables_bootstrap: 'lib/DT_bootstrap'
      shim:
        bootstrap:
          exports: 'bootstrap'
        bootstrapFileUpload:
          exports: 'bootstrapUpload'
        io:
          exports: 'io'
        jquery:
          exports: 'jQuery'
        jqueryBrowser:
          deps:    ['jquery']
        jqueryUniform:
          deps:    ['jqueryBrowser', 'jquery']
        underscore:
          exports: '_'
        backbone:
          deps:    ['underscore', 'jquery']
          exports: 'Backbone'
        datatables:
          deps:    ['jquery']
        datatables_bootstrap:
          deps:    ['jquery', 'datatables']
  
  
  
    requirejs.optimize config, (buildResponse) -&gt;
      js = true
      if js &amp;&amp; css
        require './server'
    , (err) -&gt;
      console.log 'requirejs err'
      console.log err
  </code></pre>
  
  <p>The specific error I'm seeing in chrome is:
  "Uncaught TypeError: Cannot read property 'defaults' of undefined"</p>
  
  <p>Which correlates to this snippet:</p>
  
  <pre><code>/* Set the defaults for DataTables initialisation */
  $.extend( true, $.fn.dataTable.defaults, {
  </code></pre>
  
  <p>Any idea what might be going wrong? Thanks!</p>