I would like to add a plugin system to my Electron application so that my users can add new features to my application. I was originally thinking that I would let my users upload a .zip
containing a plugin and then it would extract, and require the plugin to use it within the application. I then ran into problems with the idea.
npm
(eg lodash
)? I am not sure how this could be handled, I've looked around for similar cases but haven't found them. My ultimate goal is to have a system that works in Electron similar to how Wordpress plugins work.
You could use npm
as a child process.
You can implement your own:
require('child_process').exec(
'npm ...',
{ maxBuffer: 1024 * 500 },
function (error, stdout, stderr) {
var response = JSON.parse(stdout).dependencies;
...
}
);
or use a library, as an example: https://github.com/getstation/electron-package-manager
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.