Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inkdropapp/electron-v8snapshots-example
An example for using custom v8 snapshots in an Electron app
https://github.com/inkdropapp/electron-v8snapshots-example
Last synced: about 1 month ago
JSON representation
An example for using custom v8 snapshots in an Electron app
- Host: GitHub
- URL: https://github.com/inkdropapp/electron-v8snapshots-example
- Owner: inkdropapp
- Created: 2020-08-11T05:08:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-05T04:04:47.000Z (over 3 years ago)
- Last Synced: 2024-11-19T22:42:41.418Z (about 2 months ago)
- Language: JavaScript
- Size: 624 KB
- Stars: 60
- Watchers: 4
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example for using custom v8 snapshots in an Electron app
Generate a custom v8 snapshots using [electron-link](https://github.com/atom/electron-link) and [mksnapshot](https://github.com/electron/mksnapshot).
Read [the blog article](https://blog.inkdrop.info/how-to-make-your-electron-app-launch-1000ms-faster-32ce1e0bb52c) for detail.
## How to install
```sh
ELECTRON_CUSTOM_VERSION=13.0.1 npm install
```## How it works
### Generate v8 snapshots
Run the following command:
```sh
npm run generate-v8-snapshots
```It generates v8 snapshots containing `react` and `react-dom` libraries from `/snapshot.js`.
You should get `v8_context_snapshot.bin` in the project directory.### Copy the snapshots into Electron
```sh
npm run copy-v8-snapshots
```It copies `snapshot_blob.bin` and `v8_context_snapshot.bin` files to the Electron's binary.
### Start the Electron app
The electron app will load those libraries from the snapshots.
You should get a window like so:![ss](./images/ss.png)
As you can see, `react` and `react-dom` libraries are loaded from the v8 snapshot cache.
## Credit
Created by Takuya Matsuyama ([Twitter](https://twitter.com/inkdrop_app)) for his work called [Inkdrop](https://www.inkdrop.app/), a cross-platform Markdown note-taking app.