Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

perf(build): reduce package size and optimize V8 heap memory footprint

atharva9167j12efd99c44d2
diff --git a/electron-builder.json5 b/electron-builder.json5
index 329592d3a..d979be93c 100644
--- a/electron-builder.json5
+++ b/electron-builder.json5
@@ -58,7 +58,23 @@
// needs a system libvips we don't provide and breaks on CI/local ("vips-cpp.42 not found"), so we
// let electron-builder use the prebuilt instead of recompiling.
"buildDependenciesFromSource": false,
- "compression": "normal",
+ "compression": "maximum",
+ // Strip unused Chromium locale pak files (saves ~20 MB). Only package locales supported by OpenScreen.
+ "electronLanguages": [
+ "en-US",
+ "fr",
+ "ar",
+ "es",
+ "it",
+ "ja",
+ "ko",
+ "pt-BR",
+ "ru",
+ "tr",
+ "vi",
+ "zh-CN",
+ "zh-TW"
+ ],
"directories": {
"output": "release/${version}",
// Electron-builder's default, spelled out because the appx target depends on it:
@@ -72,6 +88,16 @@
"files": [
"dist",
"dist-electron",
+ // Exclude documentation assets that Vite copied from public/ (saves ~8 MB)
+ "!dist/demo.gif",
+ "!dist/preview*.png",
+ // Exclude assets already bundled into extraResources (saves ~17 MB duplicate in asar)
+ "!dist/wallpapers/**",
+ "!dist/cursors/**",
+ "!dist/mediapipe/**",
+ // Exclude dead-weight node_modules: all frontend and electron code is pre-bundled by Vite (saves ~238 MB)
+ "!node_modules/**",
+ "!**/node_modules/**",
"!*.png",
"!preview*.png",
"!*.md",
@@ -369,7 +395,7 @@
// in the app spawns. Shipping it added a large binary to every Windows
// installer, plus an LGPL redistribution obligation, for a file no
// shipped code opens.
- "filter": ["win32-*/*", "!win32-*/ffmpeg.exe"]
+ "filter": ["win32-*/*", "!win32-*/ffmpeg.exe", "!win32-*/ffmpeg-shared.exe"]
}
],
// The D3D11 compositor addon deliberately does NOT travel through `files` into
diff --git a/electron/main.ts b/electron/main.ts
index c01cfdfba..5dd65ecd6 100644
--- a/electron/main.ts
+++ b/electron/main.ts
@@ -77,6 +77,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
// HUD/tray/menu. Parsed before any GUI side effects; see electron/cli/.
const cliCommand = parseCliArgs(process.argv, app.isPackaged ? 1 : 2);
+// Optimize V8 heap allocation to reduce memory footprint across processes.
+app.commandLine.appendSwitch("js-flags", "--optimize-for-size");
+
// Use Screen & System Audio Recording permissions instead of the CoreAudio Tap API on macOS.
// Tap needs NSAudioCaptureUsageDescription in the parent app's Info.plist, which breaks when
// running from a terminal/IDE during dev.