perf(electron): compile the main process and preload for ES2022

apps/electron-backend/tsconfig.json now sets target ES2022, so the
main-process bundles, the preloads and the backend's Jest specs no longer
downlevel async/await, optional chaining and nullish coalescing for ES2015.
Electron 43 runs them natively in the main process and in the sandboxed
preload. tsconfig.base.json keeps es2015 because other projects inherit it.
useDefineForClassFields stays false, so class fields keep their constructor
assignment semantics and only syntax changes.

main.js + main.app.js + deferred-events.js + main.preload.js shrink from
2,008,115 to 1,853,599 bytes (-7.7%); every inlined __awaiter helper is gone.
Startup did not move measurably: main-process CPU to did-finish-load and the
J1 launch journey were flat in interleaved A/B runs, with identical counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-09-29 21:20:09 +02:00
1 parent 963a431bb7
commit 9b0b9b6944
2 files changed
+17 -1

No files matched your search

+3 -1
View File
@@ -4,7 +4,9 @@
"types": ["node"],
"moduleResolution": "nodenext",
"module": "NodeNext",
"ignoreDeprecations": "6.0"
"ignoreDeprecations": "6.0",
"target": "ES2022",
"useDefineForClassFields": false
},
"include": ["**/*.ts"]
}
+14
View File
@@ -134,3 +134,17 @@ from `app.asar`. The preload is
[workspace shell](../architecture/workspace-shell.md) for window behavior,
[DB worker](../architecture/sqlite-db-worker.md) for worker ownership and
[Electron security](../architecture/electron-security.md) for bridge boundaries.
`apps/electron-backend/tsconfig.json` sets `"target": "ES2022"` for the
main-process bundles (`main.js`, `main.app.js`, `deferred-events.js`), the
preloads and the backend's Jest specs; `tsconfig.base.json` stays at `es2015`
because other projects inherit it. Electron 43 (Node 24 and Chromium's V8) runs
ES2022 natively in the main process and in the sandboxed preload, so
async/await, optional chaining and `??` are no longer downleveled.
`"useDefineForClassFields": false` keeps the class-field semantics of the old
target (constructor assignment, not `[[Define]]`), so only syntax changed. The
workers built by `build-worker.js` (esbuild, `node18`) were already native. On
2026-09-29 the four bundles shrank from 2,008,115 to 1,853,599 bytes (every
inlined `__awaiter` gone); neither main-process CPU time to `did-finish-load`
nor the J1 launch journey's wall-clock changed measurably in an interleaved
A/B, and J1's counters were identical.