title: Display dates using moment, webpack and locale from browser
body: <p>The environment is React, Webpack, in browser.
  This code works:</p>
  
  <pre><code>console.log(new Date().toLocaleString(window.navigator.language))
  =&gt; en-au 11/01/2019, 1:33:20 pm
  </code></pre>
  
  <p>But it provides no formatting control. This code works too:</p>
  
  <pre><code>import moment from 'moment'
  import 'moment/locale/en-au'
  import 'moment/locale/fr'
  
  moment.locale(window.navigator.language)
  console.log(moment().format('L LTS'))
  =&gt; en-au 11/01/2019 1:33:20 PM
  </code></pre>
  
  <p>So <code>moment</code> does everything I need, but this code only works in the US, Australia and France. It seems that Webpack 'shakes the tree' and eliminates all the other locales provided by <code>moment</code>, except those explicitly 'required'.</p>
  
  <p>Questions:</p>
  
  <ul>
  <li>Have I understood correctly?</li>
  <li>Is this the 'right' way to do it?</li>
  <li>Is there a way to preload all/most/lots of locales without having to list them all?</li>
  </ul>
  
  <hr>
  
  <p>To try this out, start with create-react-app and then add the above code. Test it with some locale not explicitly loaded (such as 'de'). In my testing moment will default to 'en' which is 'en-us'.</p>