Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| }); | ||
| const devConfig = getDevConfig({ | ||
| config, | ||
| port, |
There was a problem hiding this comment.
Hey @chenjiahan, this should be a breaking change for v1.
This means that the dev config will no longer use the port passed from the server config.
I have a case where the assets are served on a different port (3000) than the webpack server (3800). I configured the server with the correct port 3800, but then the HMR broke because it was using the fallback on location.port which returns 3000 and not 3800.
The fix is to also specify the port for dev.client.port, which I think is a shame, if the webpack server has a different port, the HMR should follow it, unless we say otherwise by configuring it differently.
There was a problem hiding this comment.
I agree that this is a breaking change, I have updated the release note and added it to breaking change list. https://github.com/web-infra-dev/rsbuild/releases/tag/v1.0.0-alpha.0
There was a problem hiding this comment.
I knew this change would break the websocket if client and server use different ports, and users need to set dev.client.port, it is expected. Vite also requires the similar setup (server.hmr.clientPort).
There was a problem hiding this comment.
Ok then, at least the breaking change is now documented, thanks!

Summary
Fix HMR not work on online IDEs (such as MarsCode).
The default value of
client.portshould bewindow.location.portinstead ofserver.port, this allows online IDEs to proxy the ws requests to dev server correctly.Related Links
Checklist