title: requireJS optimization: undefined is not a function
body: <p>Without using optimization, application is working fine. But with optimization (minifying JS), the minified file throws "undefined is not a function" when loading homepage. </p>
  
  <p>The issue is : in the main config file, i am using like below which creates loading problem in the line <code>-- new controller() - undefined</code>. </p>
  
  <pre><code>domReady(function() {
  
          if (domReady) {
      calendar.controller = new controller();
      if (Backbone) {
                  Backbone.history.start();
              }
          }
      });
  </code></pre>
  
  <p>My build.js is below:</p>
  
  <pre><code>({
      'baseUrl': './',
      'dir': '../build/js',
      'paths': {
          'jquery': 'require-jquery',
          'underscore': 'lib/lodash.min',
          'backbone': 'lib/backbone-min',
          'mustache': 'lib/mustache',
          'bootstrap': 'lib/bootstrap.min',
          'fullcalendar': 'lib/fullcalendar.min',
          'controller': 'calendar/controllers/home_controller',
          'jqueryui':'lib/jquery-ui.min',
          'moment':'lib/moment.min',
          'customscroll':'lib/jquery.mCustomScrollbar',
          'mousewheel':'lib/jquery.mousewheel.min',
          'validate':'lib/jquery.validate.min',
          'datatable':'lib/jquery.dataTables.min',
          'blockUi':'lib/jquery.blockUI',
          'fileupload':'lib/fileuploader'
      },
      'shim': {
          'underscore': {
              'exports': '_'
          },
          'backbone': {
              'deps': ['jquery','underscore'],
              'exports': 'Backbone'
          },
          'bootstrap': {
              'deps': ['jquery'],
              'exports': 'jQuery.fn.alert'
          },
          'fullcalendar': {
              'deps': ['jquery']            
          },
          'jqueryui': {
              'deps': ['jquery']            
          },
          'customscroll': {
              'deps': ['jquery']            
          },
          'mousewheel': {
              'deps': ['jquery']            
          },
          'validate': {
              'deps': ['jquery']            
          },
          'datatable': {
              'deps': ['jquery']            
          },
          'fileupload': {
              'deps': ['jquery','jqueryui']            
          },
          'blockUi': {
              'deps': ['jquery']            
          },
          'controller': {
              'deps': ['backbone','fullcalendar','jqueryui','moment','customscroll','mousewheel','validate','datatable','blockUi','fileupload']
          }       
  
      },
      'locale': 'en-us',
      'optimize': 'uglify',
      'inlineText': true,
      'modules': [
  
          {
              'name': 'calendar/controllers/home_controller',
              'exclude': ['jquery']
  
          }
  
      ]
  })
  </code></pre>
  
  <p>RequireJS version: 2.1.1.  </p>