Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using require instead of import #3

Closed
eliot-akira opened this issue Apr 23, 2018 · 1 comment
Closed

Error when using require instead of import #3

eliot-akira opened this issue Apr 23, 2018 · 1 comment

Comments

@eliot-akira
Copy link

eliot-akira commented Apr 23, 2018

The example code in README.md results in an error: fdb.openSync is not a function. This is because the following line:

const fdb = require('foundationdb')

..results in importing an object of the shape:

{
  default: {
    FDBError: [Function: FDBError],
    configNetwork: [Function: configNetwork],
    ...
  }
}

So I had to require the module like this:

const fdb = require('foundationdb').default

Related to: Microsoft/TypeScript#2719 - ES6 Modules default exports interop with CommonJS

@eliot-akira eliot-akira changed the title Error when using require' instead of import` Error when using require instead of import Apr 23, 2018
@josephg
Copy link
Owner

josephg commented Apr 23, 2018

Thanks for catching that. Fixed & republished.

@josephg josephg closed this as completed Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants