fix: add TSC watch for main process hot-reload in dev mode#860
Merged
fix: add TSC watch for main process hot-reload in dev mode#860
Conversation
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>
Contributor
There was a problem hiding this comment.
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:watchscript to run TypeScript compiler in watch mode with--preserveWatchOutputflag - Added
electron:startscript to launch Electron with the--serveflag - Updated
electron:servescript 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
electron:serve-tsc:watchscript: runstsc -p tsconfig.serve.json --watch --preserveWatchOutputelectron:startscript:electron . --serveelectron:serveto: initial compile → then run TSC watch + Electron in parallelProblem
Since PR #859 applied
{ watchRenderer: false }toelectron-reloader, the reloader only watchesapp/main.jsfor changes. Butelectron:serve-tscwas a one-time compile with no--watch, soapp/main.jsnever changed during dev. Changes toapp/main.tshad no effect until manually restartingnpm start.How it works
wait-on tcp:4200— waits for Angular dev servernpm run electron:serve-tsc— one-time compile soapp/main.jsexists before Electron startsnpm-run-all -p electron:serve-tsc:watch electron:start— runs TSC watch + Electron in parallelapp/main.json everyapp/main.tssaveelectron-reloaderdetects the updatedapp/main.js→ relaunches ElectronTest plan
npm run lintpassesnpm run buildpassesnpm start, editapp/main.ts, save → Electron restarts with changes applied🤖 Generated with Claude Code