title: SystemJS - moment is not a function
body: <p>I'm using <code>JSPM</code>, <code>AngularJS</code>, <code>TypeScript</code>, <code>SystemJS</code> and <code>ES6</code> and my project is running pretty well... unless I try to use momentJS.</p>
  
  <p>This is the error I get:</p>
  
  <blockquote>
    <p>TypeError: moment is not a function</p>
  </blockquote>
  
  <p>This is part of the code:</p>
  
  <pre><code>import * as moment from 'moment';
  </code></pre>
  
  <p>More:</p>
  
  <pre><code>var momentInstance = moment(value);
  </code></pre>
  
  <p>If I debug it, moment is an object not a function:</p>
  
  <p><a href="https://i.stack.imgur.com/Z2aCv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Z2aCv.png" alt="enter image description here"></a></p>
  
  <p>This is what my moment.js JSPM package looks like:</p>
  
  <pre><code>module.exports = require("npm:moment@2.11.0/moment.js");
  </code></pre>
  
  <p>I've read a lot and couldn't find a way to solve this... any ideas? </p>
  
  <p>Some things I've read/tried:</p>
  
  <p><a href="https://stackoverflow.com/questions/33938561/how-to-use-momentjs-in-typescript-with-systemjs">How to use momentjs in TypeScript with SystemJS?</a></p>
  
  <p><a href="https://github.com/angular-ui/ui-calendar/issues/154" rel="noreferrer">https://github.com/angular-ui/ui-calendar/issues/154</a></p>
  
  <p><a href="https://github.com/jkuri/ng2-datepicker/issues/5" rel="noreferrer">https://github.com/jkuri/ng2-datepicker/issues/5</a></p>
  
  <p><a href="https://stackoverflow.com/questions/32987273/typescript-module-systems-on-momentjs-behaving-strangely">Typescript module systems on momentJS behaving strangely</a></p>
  
  <p><a href="https://github.com/dbushell/Pikaday/issues/153" rel="noreferrer">https://github.com/dbushell/Pikaday/issues/153</a></p>
  
  <p>Thanks!</p>