electron-plugin-manager icon indicating copy to clipboard operation
electron-plugin-manager copied to clipboard

Native Addon Modules

Open b3nab opened this issue 3 years ago • 3 comments

Hello :) I have some simple questions regarding the "native addon" for nodejs, in the Readme it's explicitly written that epm will not work with native addons.

  • Why epm cannot support nodejs native addons using pacote?
  • Could it be possible to integrate such a feature into epm?
  • To build a native addon the only required things is node-gyp I think, so could it works?

b3nab avatar Oct 26 '21 19:10 b3nab

I am not sure because I haven't tried and I didn't have a need. You can give it a go and see if it works.

pksunkara avatar Oct 26 '21 19:10 pksunkara

Actually I'm building an electron app and my plan is to support extensions to add external functionality and let other developers create some extensions. Since the app need to run on Windows, Mac and Linux there is a chance that a native module is needed, for example a way to mute and unmute the pc audio. Nodejs doesn't let this through its api and so I need to fallback and use a npm package that needs to be compiled because it was written in C/C++.

So I'm wondering what's the actual implementation? Basically you only use pacote.extract() to recursively unpack all dependencies and nothing else..?

b3nab avatar Oct 27 '21 19:10 b3nab

Yup. I extract the JS files and just load them on the manager when asked.

For a native module, loading should be fine, but we would need to build it first I guess.

pksunkara avatar Oct 27 '21 19:10 pksunkara