About a year ago, https://github.com/ionic-team/capacitor/commit/9f48abeb9d2e57e2afac1d2b5c03bea10181d6b1 included a note regarding Electron plugins:
We will have more info on building Electron plugins soon.
Has that info been made available anywhere? Is the strategy to follow what FileSystemPluginElectron does? Namely, implement a WebPlugin and just use whatever is needed from node.js like it does via require?
Does Capacitor provide any support for native-dependent modules that need separate builds between macOS/Windows/Linux?
Hey @natevwm, great question and we need to expand out those docs.
And yes that is the strategy: essentially build out a web plugin but then import and call registerElectronPlugin from @capacitor/electron.
We will be expanding those docs, but let us know how that goes!
I have a few more questions about building Electron plugins. These are all struggles I've had while building my own.
registerElectronPlugin? Should it be in the plugin's code? In the consumer's code? Should it be called in an Electron preload script, or in a regular renderer script?registerElectronPlugin method? The main npm package is a CommonJS module that doesn't contain that function. It's buried deeper inside a separate, internal ES module.electron-rebuild)?Sorry for all the questions, but I'm in the process of porting an Electron/Ionic app to Capacitor, and these are all issues I've run into.
@mlynch Any update on this ? Also interested in hearing the answers to @bcallaghan-fri questions
Most helpful comment
@mlynch Any update on this ? Also interested in hearing the answers to @bcallaghan-fri questions