Import CommonJS modules without default export via ES6
Without default
import * as foo from "foo";
var foo = require("foo");
With default
import foo from "foo";
var foo = require("foo").default;
Complete conversion here: https://github.com/sebmck/6to5/blob/master/MODULES.md#common-default
Written by Will Mruzek
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Modules
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#