title: Converting from Axios to Fetch with Promise.all()
body: <p>I am using <code>Promise.all()</code> to make a bunch of <code>axios.get()</code> calls and ensure that they all return before proceeding, like so:</p>
  
  <pre><code>Promise.all([getJSON1(), getJSON2()])
      .then((arr) =&gt; {
          var data = {
              json1: arr[0],
              json2: arr[1]
          };
  
          return data;
      });
  </code></pre>
  
  <p>The functions <code>getJSON1()</code> and <code>getJSON2()</code> look like:</p>
  
  <pre><code>function getJSON1() {
      return axios.get('json1-url.json');
  }
  </code></pre>
  
  <p>This is all working fine, however I'm wondering if replacing axios with fetch would reduce the size of my final bundle.js when webpack is done doing its thing.</p>
  
  <p>I'm trying out the <a href="https://github.com/github/fetch" rel="nofollow">fetch polyfill</a> and integrating it with webpack in accordance with <a href="http://mts.io/2015/04/08/webpack-shims-polyfills/" rel="nofollow">this blog</a>, however I'm just not sure how to adjust <code>getJSON1()</code> to use fetch. I tried the following:</p>
  
  <pre><code>function getJSON1() {
      return fetch('json1-url.json');
  }
  </code></pre>
  
  <p>This results in a <em>TypeError: Object is not a constructor (evaulating 'new Promise')</em></p>