-
Notifications
You must be signed in to change notification settings - Fork 43
Loading binaries in ES Modules #279
Comments
//cc @jasnell |
we can just pass .node through to the cjs loader. simple change. |
@devsnek that means that any module that imports a |
huh |
Any module using process.binding wouldn’t be either, though? |
I’m confused – is this about |
Also note that |
Ah, I mixed this up with |
@guybedford I do feel like ESM should have a better way than raw |
Interesting - could it be made into a singleton do you think? |
@addaleax sure, will reopen for discussion. |
they should absolutely be a supported thing to import. they have their own file extension that isn't contentious. all we need to do is pass the request to cjs, like with json |
@addaleax I'm not sure |
It would be a breaking change, and I think it depends on whether we ever want to allow loading addons from different contexts/realms. I don’t think |
In addition if you look at usage on |
I think it is worth considering that wasm modules will hopefully replace the 90% case of native modules. AFAIK many packages that expose native modules expose a CJS interface that in turn brings in the native module itself. I'm going to dig into some of the top native modules and see what interface they expose and post findings in here |
I'm less sure about that - a lot of native module exist to provide bindings for a dynamically linked system lib - even if you can take those libs and compile them to wasm, you'd lose the platform behaviors and dynamic linking (if they even still work without binding to platform APIs). Although it's probably preferable for things like decoders and encoders and other things that were just rewritten as a native module for perf. Upsides and downsides, I suppose. |
Can this be closed? |
Feel free to close, my original questions were answered on this.
…On Wed, 10 Apr 2019 at 09:40, Myles Borins ***@***.***> wrote:
Can this be closed?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#279 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAkiypifuOPkkSubXP_02fcTlw6qO1Ucks5vfZVYgaJpZM4bUj0t>
.
|
Given that we removed support for
.node
files in ECMAScript modules, the assumption is that we would useprocess.dlopen
to load binaries.process.dlopen
will create a new binary instance each time it is used or throw an error. Will this still be sufficient for binary loading?The text was updated successfully, but these errors were encountered: