Closed dsousadev closed 6 years ago
...Also, thanks for contributing :)
No problem :) when running it with Node.js I had to use .default
Oooh, yeah, if you're not using ES6+ imports then I suppose that is how it works:
> var GeminiAPI = require('gemini-api')
undefined
> GeminiAPI
{ default: { [Function: GeminiAPI] WebsocketClient: [Function: GeminiAPIWebsocketClient] } }
But this is an error:
import GeminiAPI from 'gemini-api';
const websocket = new GeminiAPI.default.WebsocketClient(params);
because default
is undefined
here.
If we're going to change the docs, perhaps we need two examples, one for ES6 modules and one for require
. But there's probably also a way to export the module so that the default
is not needed when using require
, so that'd probably be best. I can look into it, or feel free to yourself!
@dsousadev gonna close this, let me know if you'd like to reopen -- or I might do it myself.
Interesting -- that actually doesn't work for me. What's your environment?