Skip to content

fix: add TSC watch for main process hot-reload in dev mode#860

Merged
belnadris merged 1 commit intomainfrom
fix/main-process-hot-reload
Feb 27, 2026
Merged

fix: add TSC watch for main process hot-reload in dev mode#860
belnadris merged 1 commit intomainfrom
fix/main-process-hot-reload

Conversation

@belnadris
Copy link
Owner

Summary

  • Add electron:serve-tsc:watch script: runs tsc -p tsconfig.serve.json --watch --preserveWatchOutput
  • Add electron:start script: electron . --serve
  • Update electron:serve to: initial compile → then run TSC watch + Electron in parallel

Problem

Since PR #859 applied { watchRenderer: false } to electron-reloader, the reloader only watches app/main.js for changes. But electron:serve-tsc was a one-time compile with no --watch, so app/main.js never changed during dev. Changes to app/main.ts had no effect until manually restarting npm start.

How it works

  1. wait-on tcp:4200 — waits for Angular dev server
  2. npm run electron:serve-tsc — one-time compile so app/main.js exists before Electron starts
  3. npm-run-all -p electron:serve-tsc:watch electron:start — runs TSC watch + Electron in parallel
    • TSC watch recompiles app/main.js on every app/main.ts save
    • electron-reloader detects the updated app/main.js → relaunches Electron

Test plan

  • npm run lint passes
  • npm run build passes
  • npm start, edit app/main.ts, save → Electron restarts with changes applied

🤖 Generated with Claude Code

Add electron:serve-tsc:watch and electron:start scripts. Update
electron:serve to run an initial compile, then run TSC watch + Electron
in parallel so changes to app/main.ts are recompiled and picked up by
electron-reloader automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 27, 2026 12:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the main process hot-reload functionality in development mode by adding TypeScript compilation watch mode. After PR #859 disabled renderer watching in electron-reloader, main process changes were no longer detected because the initial electron:serve-tsc was a one-time compilation with no watch mode.

Changes:

  • Added electron:serve-tsc:watch script to run TypeScript compiler in watch mode with --preserveWatchOutput flag
  • Added electron:start script to launch Electron with the --serve flag
  • Updated electron:serve script to perform initial compilation, then run TSC watch and Electron in parallel

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@belnadris belnadris merged commit ab032a0 into main Feb 27, 2026
8 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.

2 participants