How do you make a Plugin/Addons for a Core Electron App?


#1

I was having difficulty seeing if anyone has done an add-on and add-on system for their electron app.

If this doesn’t exist, does one just make a desperate electron app, build an asar and import the asar(s) in the core app?


#2

Atom has a package system, as well as a package manager that builds on npm functionality.


#3

We are actually working on a proposal for that… we have an Electron boilerplate using React & React-MDL (look here: https://github.com/appelgriebsch/electron-boilerplate/tree/reactjs) and integrated some module/plugin system on it (HelloWorld example: https://github.com/appelgriebsch/HelloWorldModule).

Actually the boilerplate / shell bundles some services (PouchDB, Lovefield, …) and offers a settings panel in which you can maintain your plugins / addons.

Addons itself are bundled as ASAR files and can be dropped into the boilerplate/shell to get registered. We come to a blocking point actually,

  • we bundle the fundamental libraries such as React, React-MDL, React-Router, … with the boilerplate/shell itself,
  • and just strip them out of the modules to reduce the load and size of them (devDependencies in module, npm prune --production during build of module)

but: if we load and require the module in the shell, we got an exeption triggered that the dependencies are not there. This only happens when loading the module via an ASAR file. When doing the same via an unpacked folder everything works fine (the dependencies were taken from the shell itself).

Why does the loading / requiring of components from the ASAR archive behave differently? Is there a way in which we can specify additional “lookup folders” for the dependencies when loading ASAR archives?