title: How can I import a namespace?
body: <p>I have a JavaScript file which contains the following:</p>
  
  <pre class="lang-js prettyprint-override"><code>const api = {
    call(type, url, data) {
      console.log(type + "bar");
    },
  
    get(url, query) {
      this.call("foo");
    }
  }
  </code></pre>
  
  <p>I'm wanting to be able to call <code>api.get()</code> across multiple different files where necessary, but I'm having trouble importing this.</p>
  
  <ol>
  <li><p>Loading the file alone through <code>import</code> gives me a ReferenceError when I attempt to access the <code>api</code> variable:</p>
  
  <pre><code>import "services/api.js";
  console.log(api);
  </code></pre>
  
  <blockquote>
    <p>Uncaught ReferenceError: api is not defined</p>
  </blockquote></li>
  <li><p>Giving the import a name (of <code>api</code>) returns an Object, but it has no inner methods:</p>
  
  <pre><code>import api from "../../services/api.js";
  console.log(api);
  console.log(api.get);
  </code></pre>
  
  <blockquote>
    <p>Object {}<br>
    undefined</p>
  </blockquote></li>
  </ol>
  
  <p>What am I doing wrong?</p>