Formalize HMR dev setup with hidden webpack dev server - #8109
Conversation
Run the webpack dev server on a hidden port (2880) so developers keep using port 3000 for the app. This avoids cross-origin issues with embedded Node-RED editors and port conflicts with other local services. The dev server only handles HMR websocket updates while writing the built files to disk for the Fastify backend to serve. Closes #8108 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8109 +/- ##
=======================================
Coverage 76.17% 76.17%
=======================================
Files 440 440
Lines 23604 23604
Branches 6285 6285
=======================================
Hits 17981 17981
Misses 5623 5623
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
n-lark
left a comment
There was a problem hiding this comment.
- Run npm run build-watch-hmr and verify it compiles and starts on port 2880
- ❌ Open http://localhost:3000 and verify the app loads
So to get this to run I need both of these running -
# Terminal 1
npm run start-watch # Fastify backend → serves 3000
# Terminal 2
npm run build-watch-hmr # webpack HMR → 2880
If we wanted one command could probably do something like:
"serve-hmr": "npm-run-all --parallel build-watch-hmr start-watch"
- 🔥 Edit a Vue component and verify HMR applies the change without full reload
- Open an embedded Node-RED editor and verify the iframe loads without CORS errors
I have a habbit of running them independently and didn't want to impose, but yes we should also have a hmr flavored serve as well.
that is a very valid point |
Closes #8108
Summary
build-watch-hmrnpm script that mirrorsbuild-watchbut with HMR enabledHow it works
The dev server writes built files to disk (
writeToDisk: true) for the Fastify backend to serve on port 3000. The HMR client in the browser connects tows://localhost:2880/wsfor live updates. No proxy rules or CORS needed.Usage
Or use
npm run servewithbuild-watch-hmrinstead ofbuild-watchif you want both in one terminal.Test plan
npm run build-watch-hmrand verify it compiles and starts on port 2880http://localhost:3000and verify the app loads🤖 Generated with Claude Code