Skip to content

inkdropapp/electron-v8snapshots-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example for using custom v8 snapshots in an Electron app

Generate a custom v8 snapshots using electron-link and mksnapshot.

Read the blog article for detail.

How to install

ELECTRON_CUSTOM_VERSION=13.0.1 npm install

How it works

Generate v8 snapshots

Run the following command:

npm run generate-v8-snapshots

It generates v8 snapshots containing react and react-dom libraries from <PROJECT_DIR>/snapshot.js. You should get v8_context_snapshot.bin in the project directory.

Copy the snapshots into Electron

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

As you can see, react and react-dom libraries are loaded from the v8 snapshot cache.

Credit

Created by Takuya Matsuyama (Twitter) for his work called Inkdrop, a cross-platform Markdown note-taking app.

About

An example for using custom v8 snapshots in an Electron app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published