Desktop ESM Import Resolution Fix

Created: 2026-05-20 18:30 EDT ยท Branch: lavender/codex-login-management-electron

Summary

Fixed a desktop startup crash where Electron failed to load @islandflow/types with ERR_MODULE_NOT_FOUND for packages/types/src/events. The types package now uses explicit .ts relative imports, and desktop TypeScript build settings were updated to permit and rewrite those imports during emit.

Changes Made

Context

The desktop app launches via Electron (Node ESM behavior), while much of this monorepo is typically run through Bun. Bun accepts extensionless TypeScript relative imports that Node ESM does not. Since @islandflow/types exports source TS (./src/index.ts), Electron loaded those sources directly and failed on extensionless sibling imports.

Important Implementation Details

Relevant Diff Snippets

Unified patch snippets below are diffs.com-compatible patch text format.

diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
-export * from "./events";
+export * from "./events.ts";
-export * from "./live";
+export * from "./live.ts";

...

diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json
 "noEmit": false,
+"allowImportingTsExtensions": true,
+"rewriteRelativeImportExtensions": true,
 "sourceMap": true,

Expected Impact for End-Users

Desktop developers can run bun run dev:desktop without the startup crash. This unblocks local desktop testing and feature work without requiring manual runtime flags or ad hoc environment tweaks.

Validation

Issues, Limitations, and Mitigations

Follow-up Work

Beads issue: islandflow-64s.