

Share one Electron instance for multiple apps ?
source link: https://www.tuicool.com/articles/jmE3uqa
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

electron-global
A tool for building lighweight Electron apps using a global Electron instance. Forget about 100MB for a Hello World app in Electron!
How it works?
electron-global
creates a custom Electron distributable with a small app launcher which checks the app's package.json
and downloads corresponding major
version and the newest in case of minor
and patch
. The Electron versions are being saved to:
~/.electron-global/x %HOMEPATH%/.electron-global/x
Where x
is the major version of Electron (e.g. 6).
Then the distributable can be used with electron-builder
to build the app installers.
Installation
The electron-builder
package is also required to successfully build an app.
$ npm install --save-dev electron-global electron-builder
Usage
You need to create electron-builder.json
file in your project directory, configure it and specify electronDist
directory to where the electron-global
generates the output (default is ./electron-global
). Example:
{ ... "electronDist": "./electron-global" ... }
Then you can run the following command (example for macOS):
$ electron-global -m && electron-builder -m
CLI Options:
Usage: electron-global [options] Options: -m, --mac Create Electron dist for macOS. -l, --linux Create Electron dist for Linux. -w, --windows Create Electron dist for Windows. -o, --output <path> Output path of the created Electron runtime launcher. Defaults to `./dist/runtime`. --projectDir, --project The path to project directory. Defaults to current working directory. -h, --help output usage information
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK