Skip to content

fix(desktop): externalize @wavegrid/doctor so main.js stops requiring ws itself - #90

Merged
pyramation merged 1 commit into
mainfrom
fix/desktop-ws-external
Aug 9, 2026
Merged

fix(desktop): externalize @wavegrid/doctor so main.js stops requiring ws itself#90
pyramation merged 1 commit into
mainfrom
fix/desktop-ws-external

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

pnpm start in packages/desktop died at launch with Cannot find module 'ws' (regression from #88).

@wavegrid/doctor was missing from vite.main.config.ts's rollup external list, so Rollup inlined it into main.js. Its own import { WebSocket } from 'ws' then became a bare require("ws") inside the desktop bundle, resolved from packages/desktop — which never declares ws:

- const doctor = require("@wavegrid/doctor");   // resolves ws from doctor's own node_modules
+ const ws = require("ws");                    // resolved from packages/desktop → ENOENT

It only worked on my machine because pnpm had hoisted a ws copy into the workspace root node_modules, which shadowed the bug; a clean/differently-hoisted install (Dan's) has nothing to resolve.

Fix is one line — add '@wavegrid/doctor' to external, matching the other brain packages — plus __tests__/main-externals.test.ts, which parses the external array out of vite.main.config.ts and asserts every @wavegrid/* that src/main* imports appears in it. This class of break is invisible to tsc --noEmit, lint and the unit suite (all green while the app couldn't boot), so the guard is the point of the PR as much as the fix. Verified it fails when the line is removed.

Link to Devin session: https://app.devin.ai/sessions/972698f89f494b86828010666a002b8f
Requested by: @pyramation

@pyramation pyramation self-assigned this Aug 9, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit c8a62e8 into main Aug 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant