title: How to prevent moment.js from loading locales with webpack?
body: <p>Is there any way you can stop <code>moment.js</code> from loading all the locales (I just need English) when you're using webpack? I'm looking at the source and it seems that if <code>hasModule</code> is defined, which it is for webpack, then it always tries to <code>require()</code> every locale. I'm pretty sure this needs a pull request to fix. But is there any way we can fix this with the webpack config?</p>
  
  <p>Here is my webpack config to load momentjs:</p>
  
  <pre><code>resolve: {
              alias: {
                  moment: path.join(__dirname, "src/lib/bower/moment/moment.js")
              },
          },
  </code></pre>
  
  <p>Then anywhere I need it, I just do <code>require('moment')</code>. This works but it's adding about 250 kB of unneeded language files to my bundle. Also I'm using the bower version of momentjs and gulp.</p>
  
  <p>Also if this can't be fixed by the webpack config here is <a href="https://github.com/moment/moment/blob/develop/moment.js#L760-L772" rel="noreferrer">a link to the function where it loads the locales</a>. I tried adding <code>&amp;&amp; module.exports.loadLocales</code> to the <code>if</code> statement but I guess webpack doesn't actually work in a way where that would work. It just <code>require</code>s no matter what. I think it uses a regex now so I don't really know how you would even go about fixing it.</p>