haxe-js-kit
haxe-js-kit copied to clipboard
Can I use webpack (or something similar) with these externs?
I recently posted this as a stack overflow question, but I guess it's also relevant to the author(s) of this library.
After I posted that question, I read the rest of this repo's README, and it looks like there is a mechanism for including require statements. So I guess I'll look into that. But then my question is: why not just use @:jsRequire("fs")?
I started haxe-js-kit
before there was @:jsRequire
, that's why it includes its own require
mechanism, for example here: https://github.com/clemos/haxe-js-kit/blob/develop/js/npm/socketio/Server.hx#L8
It's a macro that uses @:jsRequire
under the hood (replaces implements ...
with @:jsRequire
and keeps track of all require
d libs).
Both @:jsRequire
and npm.Package.Require
work on the client side too (https://github.com/clemos/haxe-js-kit/tree/develop/js/browser), together with things like browserify
.
But haxe-js-kit
doesn't "promote" them / use them for client libraries.
I think it might be a good idea to tag these classes for use with browserify
/ webpack
.
I see. So all that's left to do is add lines like implements npm.Package.Require<"socket.io","1.0">
to client classes? I'm happy to create a PR to do that sometime this week.
Or would you prefer to switch over to using @:jsRequire
?