No default ES module export when using `import dgraph from "dgraph-js"`

Moved from GitHub dgraph-js/41

Posted by aryzing:

I’m currently bundling my server project using webpack, while using babel-loader for the transpilation (set with the modules: false option so module import code is handled by webpack.

When importing dgraph-js, it throws a runtime error if I import it without star, but works fine with the star import:

import dgraph from 'dgraph-js' // ERROR in runtime
import * as dgraph from 'dgraph-js' // OK

The last time the package was published was about 6 months ago, not sure if trying again with a newer version of TypeScript would help, perhaps using the esModuleInterop: true flag?

MichelDiz commented :

If you’re using TypeScript you should use the star.