Generate a custom v8 snapshots using electron-link and mksnapshot.
Read the blog article for detail.
ELECTRON_CUSTOM_VERSION=13.0.1 npm install
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.
npm run copy-v8-snapshots
It copies snapshot_blob.bin
and v8_context_snapshot.bin
files to the Electron's binary.
The electron app will load those libraries from the snapshots. You should get a window like so:
As you can see, react
and react-dom
libraries are loaded from the v8 snapshot cache.
Created by Takuya Matsuyama (Twitter) for his work called Inkdrop, a cross-platform Markdown note-taking app.