Open dmill-bz opened 8 years ago
Chunking through tons of unread emails, sorry about the late reply.
I think using export default create
in index.js
is what causes the issue here.
export default
defines what will be imported when you do import foo from 'module'
. foo
will be anything you decide to export after that export default
statement.
You're simultaneously doing export const create = () => {
and doing a default export
of that same create
function. With the current setup (if you skip the export default
for now), you can do this:
import * as GremlinConsole from 'gremlin-console-js';
// OK:
GremlinConsole.create()
An alternative way is to export default
an Object rather than a function
export default {
create
}
// equivalent to export default { create: create } thanks to a syntax shorthand
which allows you to import the create
function in the following way
import { create } from 'gremlin-console-js';
I think https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export will give better insights.
Thanks!! I'll have a look and try at it again.
@jbmusso I'm going to need your help one more time (sorry for the trouble).
I'm basically almost done. Once the two issues here are taken care of and I replace the current code on gremlin-bin to use this library (which should be the last use case I need to be confident in the lib). I'll move this into 1.0.0.
The help I need is in regards to the difference between the calls in these two implementations (took this from one of the plugin's docs) :
Using ES2015/2016
In browser
As you can see there's nothing homogenous about the two. I would like to make the browser implementation the same as the other. I've tried playing around with
webpack.config.babel.js
without success. I know that's the right place but I can't seem to pull it off. Any ideas?Thanks a ton.