mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
The packaged Linux headless entry crashed at module-load with
ERR_MODULE_NOT_FOUND for 'electron'. Trace from the CI artifact:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'electron' imported
from .../packaged/dist/headless.mjs
at Object.getPackageJSONURL ...
Root cause: headless.ts pulls in `./config.js` for the
PACKAGED_NAMESPACE_ENV constant and the PackagedConfig type. config.ts
had a top-level `import { app } from "electron"`, so ESM had to resolve
electron at module load even though headless never calls the two
functions (readRawPackagedConfig / readPackagedConfig) that actually use
`app`. Headless deliberately ships without electron in its
node_modules, so resolution failed.
Move the electron `app` import behind a `loadElectronApp()` helper that
calls `await import("electron")` only when one of the two electron-only
functions runs. headless.ts can now load config.ts to read constants
and types without ever pulling electron in.
apps/packaged
Thin packaged Electron runtime entry for Open Design.
This package starts the packaged daemon and web sidecars, registers the od://
entry protocol, and then delegates to @open-design/desktop/main for the host
window. Product logic stays in apps/daemon, apps/web, and apps/desktop.