title: Dynamically require an aliased module using webpack
body: <p>I'm configuring a bunch of module aliases through webpack via <code>resolve.alias</code>. Then, in my app code, I would like to require one of these modules using a variable that contains an alias name:</p>
  
  <pre><code>var module = require(moduleAlias);
  </code></pre>
  
  <p>Unfortunately, this creates a "context module" containing everything in the script's directory and its descendants which isn't what I was after in this particular case. Also, since nowhere in my code am I explicitly requiring all the aliased modules, they don't get built into my app.</p>
  
  <p>Two questions:</p>
  
  <ol>
  <li>How do I make sure all aliased modules are bundled with my code?</li>
  <li>How do I access them using a variable that contains an alias?</li>
  </ol>
  
  <p>Thanks!</p>