title: exporting js prototype class using an IIFE
body: <p>I seem to be having an issue while exporting a prototype class.</p>
  
  <p>To give an example:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/* eslint no-shadow:0 */
  var UtilityManager = (function(w, d, c) {
   function UtilityManager() {
    c.log('UtilityManager created!');
   }
  
   UtilityManager.prototype.extendObject = function(base, extending) {
    var key;
  
    if (typeof extending !== 'object') {
     c.warn('Extending object is not of type Object');
     extending = {};
    }
  
    for (key in extending) {
     if (Object.hasOwnProperty.call(base, key)) {
      base[key] = extending[key];
     }
    }
  
    return base;
   };
  
   return UtilityManager;
  }(window, document, console));
  
  export default UtilityManager;</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I try and access this code using</p>
  
  <pre><code>UtilityManager = require('./helpers/dfp.utility');
  UtilityManager = new UtilityManager();
  </code></pre>
  
  <p>First I hoped this would work:</p>
  
  <pre><code>UtilityManager = new (require('./helpers/dfp.utility'))();
  </code></pre>
  
  <p>Unfortunately it doesn't. Explanation welcome :)
  Anyways, when running the code I get following error message:</p>
  
  <blockquote>
    <p>Uncaught TypeError: UtilityManager is not a constructor</p>
  </blockquote>
  
  <p>How come?</p>