I have a node.js library lib
written in ES6 (compiled with Babel) in which I export the following submodules:
"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;
If from my main project I include the library like this
import * as lib from 'lib';
console.log(lib);
I can see the proper output and it work as expected { config: ... }
. However, if I try to include the library like this:
import lib from 'lib';
console.log(lib);
it will be undefined
.
Can someone explain what is happening here? Aren't the two import methods supposed to be equivalent? If not, what difference am I missing?