Current Behavior
Running task electron:quickdev (or npm run dev) crashes immediately after the main process builds. The Electron app never opens. This is a regression introduced by the Electron 41 upgrade (Node.js v24) and affects the main branch as of the current HEAD.
Expected Behavior
The dev server starts and the WaveTerm window opens.
Steps To Reproduce
- Clone the repo at current
main (latest commit as of 11/4/2026 : 263eda42)
- Run
task electron:quickdev (or npm run dev)
- Wait for the main process bundle to build (
dist/main/index.js)
- Observe the Electron process crash before any window appears
Wave Version
v0.14.4
Platform
macOS
OS Version/Distribution
macOS 26.3.1
Architecture
arm64
Anything else?
Actual Behavior
The Electron process exits immediately with:
file:///...waveterm/dist/main/index.js:2
import electron__default, { app, ipcMain, dialog, shell, Notification, webContents, safeStorage, net as net$1, WebContentsView, BaseWindow, screen, globalShortcut, BrowserWindow } from "electron";
^^^^^^^^^^
SyntaxError: The requested module 'electron' does not provide an export named 'BaseWindow'
at #asyncInstantiate (node:internal/modules/esm/module_job:319:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:422:5)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
Node.js v24.14.0
Root Cause (Investigated)
Electron 41 bundles Node.js v24, which applies stricter CJS-to-ESM named export static analysis. Certain Electron APIs that are exposed via lazy getters (not direct property assignments) in Electron's CJS module — specifically BaseWindow and BrowserWindow — are no longer detected as valid static named exports by Node.js v24's ESM module loader.
The built bundle (dist/main/index.js) contains:
import electron__default, { ..., BaseWindow, ..., BrowserWindow } from "electron";
Node.js v24 rejects this at parse time with a SyntaxError before any code executes.
Cascading behavior (important): Simply removing BaseWindow and BrowserWindow from the named import list does not fix the issue. It causes subsequent exports in the list (Notification, then app, etc.) to begin failing — a cascading static analysis failure that suggests the presence of these lazy-getter exports in the request list triggers a broader CJS export detection pass in Node.js v24. Removing them collapses that detection, causing previously-working exports to fail.
Additional Notes
- This does not affect preload scripts — they are already correctly output as
.cjs and require('electron') works fine in that context.
- The
npm run start (electron-vite preview) path is also affected since it runs the same built dist/main/index.js.
- The issue is reproducible from a clean clone with no modifications.
package.json specifies "electron": "^41.1.0" but the installed version at the time of testing was 41.0.2 (lock file); upgrading to 41.2.0 does not resolve the issue.
Possible Fix Direction
Per the electron-vite ESM migration docs, the recommended pattern for CJS-based packages in ESM mode is default imports rather than named imports:
// Instead of:
import { BaseWindow, BrowserWindow } from 'electron'
// Use namespace access:
import * as electronNs from 'electron'
const BaseWindow = electronNs.BaseWindow
const BrowserWindow = electronNs.BrowserWindow
However, due to the cascading static analysis behavior noted above, a more holistic approach to how the electron module is imported across all emain/ files may be needed.
Current Behavior
Running
task electron:quickdev(ornpm run dev) crashes immediately after the main process builds. The Electron app never opens. This is a regression introduced by the Electron 41 upgrade (Node.js v24) and affects themainbranch as of the current HEAD.Expected Behavior
The dev server starts and the WaveTerm window opens.
Steps To Reproduce
main(latest commit as of 11/4/2026 :263eda42)task electron:quickdev(ornpm run dev)dist/main/index.js)Wave Version
v0.14.4
Platform
macOS
OS Version/Distribution
macOS 26.3.1
Architecture
arm64
Anything else?
Actual Behavior
The Electron process exits immediately with:
Root Cause (Investigated)
Electron 41 bundles Node.js v24, which applies stricter CJS-to-ESM named export static analysis. Certain Electron APIs that are exposed via lazy getters (not direct property assignments) in Electron's CJS module — specifically
BaseWindowandBrowserWindow— are no longer detected as valid static named exports by Node.js v24's ESM module loader.The built bundle (
dist/main/index.js) contains:Node.js v24 rejects this at parse time with a
SyntaxErrorbefore any code executes.Cascading behavior (important): Simply removing
BaseWindowandBrowserWindowfrom the named import list does not fix the issue. It causes subsequent exports in the list (Notification, thenapp, etc.) to begin failing — a cascading static analysis failure that suggests the presence of these lazy-getter exports in the request list triggers a broader CJS export detection pass in Node.js v24. Removing them collapses that detection, causing previously-working exports to fail.Additional Notes
.cjsandrequire('electron')works fine in that context.npm run start(electron-vite preview) path is also affected since it runs the same builtdist/main/index.js.package.jsonspecifies"electron": "^41.1.0"but the installed version at the time of testing was41.0.2(lock file); upgrading to41.2.0does not resolve the issue.Possible Fix Direction
Per the electron-vite ESM migration docs, the recommended pattern for CJS-based packages in ESM mode is default imports rather than named imports:
However, due to the cascading static analysis behavior noted above, a more holistic approach to how the
electronmodule is imported across allemain/files may be needed.