title: How to utilize Axios/Fetch in Google Apps Script with Clasp?
body: <h2>The Setup</h2>
  
  <ul>
  <li>I am utilizing <a href="https://github.com/labnol/apps-script-starter" rel="nofollow noreferrer">https://github.com/labnol/apps-script-starter</a> <em>(contains clasp, babel and webpack)</em> and set it up correctly in order to work on a Google Sheets Addon.</li>
  <li>I am using Quokka.js + Node within VS Code for prototyping</li>
  </ul>
  
  <h2>The Goal</h2>
  
  <p>I started developing sidebars and initial functions and everything works great. Now I want to work with Rest APIs and be able to work with the output both in Node.js as well as in the Google Sheets Addon I am building.</p>
  
  <p><em>I understand the following premises:</em></p>
  
  <ul>
  <li>Node doesn't support UrlFetchApp.fetch</li>
  <li>GAS doesn't support native fetch (due to lack of the window and dom objects)</li>
  </ul>
  
  <p>So I decided to test out </p>
  
  <ul>
  <li>babel-polyfill (this seems to work fine on its own)</li>
  <li>axios (causing issues)</li>
  </ul>
  
  <p>use to handle promises, in order to allow the prototyping in node yet also get the same outcome in the browser.</p>
  
  <h2>The Challenge</h2>
  
  <p>Within node, everything works as expected, however once I add</p>
  
  <pre class="lang-js prettyprint-override"><code>const axios = require('axios');
  </code></pre>
  
  <p>to any .js file in my project I receive the following error when trying to push the code via Clasp.</p>
  
  <pre><code>{ code: 400, errors: [ { message: 'Syntax error: Missing name after . operator.', line: ..., domain: 'global', reason: 'badRequest' } ] }
  </code></pre>
  
  <p>The given line throwing the error is <code>module.exports.default = axios;</code></p>
  
  <p>Once I comment out this line, the Clasp push works, but axios isn't working in the GAS environment. (I also tried Fetch Polyfills (like cross-fetch) but run into the same issues)</p>
  
  <p>Any ideas on how to accomplish my goal would be greatly appreciated!</p>