trilium/scripts
Elian Doran 5d1c5ff973
feat(desktop): switch the Electron main bundle to ESM with code splitting
The main process now builds as main.mjs with dynamic-import boundaries
split into chunks/ that only load on first use; dist/package.json
points Electron at the new entry. The preload stays CJS (Electron's
sandboxed renderer cannot load ESM preloads) and image_worker.cjs
stays CJS (spawned by its path).

The ESM banner now resolves __dirname in a chunk to the bundle root
rather than chunks/: bundled code uses __dirname to find siblings of
the entry (preload.cjs, image_worker.cjs, getResourceDir), and which
chunk a module lands in must not change what the path means.

Verified by launching the built app: the renderer loads over
trilium-app:// and reaches the backend through the preload bridge.
Main-process RSS on identical boots: 348 MB (CJS) -> 287 MB (ESM).
The "Error executing query" lines at boot predate this change
(identical under CJS).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 22:27:37 +03:00
..
icon-packs feat(icon-pack-builder): integrate boxicons 3 with brands 2025-12-28 22:53:03 +02:00
icons feat(mobile/ios): add trilium icon 2026-04-22 14:43:10 +03:00
repo-migration chore(scripts): add proper typechecking 2025-12-08 14:13:18 +02:00
translation fix(scripts): read every page of the Weblate language stats 2026-08-20 13:26:02 +03:00
analyze-perf.ts perf(dev): give each dev server its own Vite dep cache 2026-08-10 18:05:32 +03:00
build-portable-better-sqlite3.sh build(ci): rebuild better-sqlite3 against an older glibc for Linux releases 2026-07-25 17:59:19 +03:00
build-utils.ts feat(desktop): switch the Electron main bundle to ESM with code splitting 2026-08-20 22:27:37 +03:00
check-version-consistency.ts fix(ci): sanity check does not account for version prefix 2026-03-01 17:43:41 +02:00
electron-run-prod.mts fix(desktop): make start-prod launch Electron correctly on NixOS 2026-07-18 13:29:30 +03:00
electron-start.mts chore(scripts): typecheck the maintenance scripts 2026-08-19 20:53:11 +03:00
filter-tsc-output.mts build: name the native compiler @typescript/native, and record why the compat package is unusable 2026-08-09 18:10:36 +03:00
release-notes-body.mts ci(release): pin release note images to the tag being published 2026-08-19 20:47:01 +03:00
release-notes-body.spec.ts ci(release): pin release note images to the tag being published 2026-08-19 20:47:01 +03:00
tsconfig.json feat(website): offer every language Weblate reports as translated 2026-08-20 11:01:19 +03:00
update-build-info.ts fix(scripts): update build info no longer updating 2026-04-07 16:00:44 +03:00
update-contributors.ts contributor list: update script name, change a comment 2026-04-19 18:33:35 +03:00
update-flake-electron.spec.ts ci(nix): sync the flake's Electron pin automatically 2026-08-08 15:55:22 +03:00
update-flake-electron.ts ci(nix): sync the flake's Electron pin automatically 2026-08-08 15:55:22 +03:00
update-nightly-version.ts refactor(standalone): rename project from client-standalone 2026-05-16 08:57:55 +03:00
update-version.ts refactor(standalone): rename project from client-standalone 2026-05-16 08:57:55 +03:00
utils.mts fix(desktop): make start-prod launch Electron correctly on NixOS 2026-07-18 13:29:30 +03:00
vitest.config.ts fix(scripts): expire the Weblate language-stats cache 2026-08-20 10:10:22 +03:00
wipe-node-modules.mts chore(scripts): add a way to wipe node modules 2026-03-26 11:27:46 +02:00