Skip to content

Commit c54498e

Browse files
authored
fix: dev-remote hmr port override (#4163)
## Changes <!-- Brief summary of your changes that is easy to understand --> This removes the ability to override the hmr port in the vite config to avoid breaking the system. ## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> vite uses the same port for the server and hmr, so by just providing the port override via flag which we already have it works fine. The problem comes when a user overrides the vite.config.js file with this ``` server: { hmr: { port: 1234, }, }, ``` This breaks the system, and there's no reason the user will need that when running the dev-remote command as we control it ## Tests <!-- How have you tested the changes? --> <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. --> Co-authored-by: MarioCadenas <[email protected]>
1 parent 6098fef commit c54498e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/workspace/apps/vite-server.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ async function startViteServer() {
4848
clientPath
4949
);
5050
const userConfig = loadedConfig?.config ?? {};
51+
52+
/**
53+
* Vite uses the same port for the HMR server as the main server.
54+
* Allowing the user to set this option breaks the system.
55+
* By just providing the port override option, Vite will use the same port for the HMR server.
56+
* Multiple servers will work, but if the user has this in their config we need to delete it.
57+
*/
58+
delete userConfig.server?.hmr?.port;
59+
5160
const coreConfig = {
5261
configFile: false,
5362
root: clientPath,

0 commit comments

Comments
 (0)