title: RequireJS - Exporting a Set of Functions
body: <p>I'm experiencing an issue with <strong>RequireJS</strong> where I'm not able to <em>export</em> a set of functions when I have a <strong>require</strong> statement.</p>
  
  <p>Let's assume I have a file called <strong>mySubFile.js</strong>, where, first I need to inject <strong>jQuery</strong> and then another dependency. Now, Let's suppose I have <strong>myFunction</strong> and I want to export it in order to get called from another file.</p>
  
  <pre><code>define('mySubFile', ['jquery'], function ($) {
      require(['dependency1'], function (dependency1) {
  
         let myFunction = function(){ return "Hey There"; }
  
         return : {
                      myFunction : myFunction
         }
  
      });
  });
  </code></pre>
  
  <p>Now let's assume that I want to call that function from <strong>myFile.js</strong>:</p>
  
  <pre><code>define('myFile', ['jquery'], function ($) {
      require(['mySubFile'], function (mySubFile) {
  
         console.log(mySubFile.myFunction());
  
      });
  });
  </code></pre>
  
  <p>This does not work. I get:</p>
  
  <blockquote>
    <p>Cannot read property 'myFunction' of undefined.</p>
  </blockquote>
  
  <p>On the other side, If I define <strong>mySubFile.js</strong> as follows:</p>
  
  <pre><code>define('mySubFile', ['jquery', 'dependency1'], function ($, dependency1) {
  
     let myFunction = function(){ return "Hey There"; }
  
     return : {
                 myFunction : myFunction
     }
  
  });
  </code></pre>
  
  <p>I can access <strong>myFunction</strong> but I NEED to first resolve <strong>jQuery</strong>.</p>
  
  <p>I'm struggling trying to find a solution to this but still haven't found anything.</p>
  
  <p><strong>How Can I Solve this?</strong></p>