title: Loading external javascript library with RequireJS
body: <p>I built a small javascript library I need to use inside a BackboneJS project.
  My problem is, I have an issue to use the library. I think I did something wrong, when I'm trying to access it, I got an "undefined".</p>
  
  <p>Some code below, I simplified it.</p>
  
  <p>The library looks something like that - myLibrary.js:</p>
  
  <pre><code>(function() {
      var myLibrary = this;
  
      var initialize = function() {
          console.log('initialize');
      };
  
      myLibrary.otherFunction = function() {
          console.log('otherFunction');
      };
      return myLibrary;
  })();
  </code></pre>
  
  <p>I putted my library in my requirejs config:</p>
  
  <pre><code>requirejs.config({
      paths: {
          jquery: "js/jquery"
          myLibrary: "js/myLibrary"
      }, 
      shim: {
          myLibrary: {
              deps: ['jquery']
          }
      }
  });
  </code></pre>
  
  <p>And I'm trying to use my library inside a BackboneJS view</p>
  
  <pre><code>define([
    'jquery',
    'backbone',
    'myLibrary'
  ], function($, Backbone, myLibrary){
      'use strict';
  
      return Backbone.View.extend({
  
          initialize: function() {
              console.log(myLibrary); 
              //myLibrary is undefined here!
              //I'd like to access myLibrary as an object 
              //to access my functions inside..
          }
      });
  });
  </code></pre>
  
  <p>The library is loaded. I can see it in the Network tab of my developer bar.</p>
  
  <p>If you have any idea what's wrong here?</p>
  
  <p>Thanks.</p>