title: Difference between import X and import * as X in node.js (ES6 / Babel)?
body: <p>I have a node.js library <code>lib</code> written in ES6 (compiled with <a href="https://babeljs.io/" rel="noreferrer">Babel</a>) in which I export the following submodules:</p>
  
  <pre><code>"use strict";
  
  import * as _config from './config';
  import * as _db from './db';
  import * as _storage from './storage';
  
  export var config = _config;
  export var db = _db;
  export var storage = _storage;
  </code></pre>
  
  <p>If from my main project I include the library like this</p>
  
  <pre><code>import * as lib from 'lib';
  console.log(lib);
  </code></pre>
  
  <p>I can see the proper output and it work as expected <code>{ config: ... }</code>. However, if I try to include the library like this:</p>
  
  <pre><code>import lib from 'lib';
  console.log(lib);
  </code></pre>
  
  <p>it will be <code>undefined</code>.</p>
  
  <p>Can someone explain what is happening here? Aren't the two import methods supposed to be equivalent? If not, what difference am I missing?</p>