[Issue #9] Hot reload for development #19
Reference in New Issue
Block a user
Delete Branch "issue-9-hot-reload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add automatic rebuild and browser reload functionality for development. When Go source files change, the WASM binary is automatically rebuilt and connected browsers reload to show the updated application.
Changes
watcher.go): File system watcher using polling to detect changes in Go source filesbuilder.go): Executes WASM compilation when files changelivereload.go): WebSocket server for browser-to-server communicationinject.go): Injects reload script into HTML responsesdevserver.go): Combines all components into an easy-to-use development serverREADME.mdwith hot reload documentationUsage
Closes #9
Implement automatic rebuild and browser reload during development: - File watcher monitors .go files for changes with configurable extensions - Builder compiles Go source to WASM on file changes - LiveReload WebSocket server notifies connected browsers to reload - DevServer combines all components for easy development setup - HTML injection adds reload script automatically Usage: dev := host.NewDevServer("public", "index.html", ".", "public/app.wasm") dev.ListenAndServe(":8080") Closes #9 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>Code Review
Summary
Excellent feature addition implementing automatic rebuild and browser reload for development. Well-architected with clean component separation.
Highlights
Issue: Unused Code
host/devserver.go lines 461-473 - The
responseWriterstruct is defined but never used:Please remove this unused code before merging.
Minor Notes
Code Review - Approved
Excellent hot reload feature with clean architecture and good test coverage.
Highlights
Previous Feedback
Unused
responseWriterstruct removed.LGTM - merging.