Skip to content

Commit

Permalink
fix(remix-dev): re-use REMIX_DEV_SERVER_WS_PORT when reloading conf…
Browse files Browse the repository at this point in the history
…ig (#3206)

Co-authored-by: Kent C. Dodds <[email protected]>
  • Loading branch information
mcansh and kentcdodds authored May 17, 2022
1 parent 89327a9 commit 1ab9745
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ describe("readConfig", () => {
`
);
});

it("returns the same devServerPort value across reloads", async () => {
let newConfig = await readConfig(remixRoot);
expect(newConfig.devServerPort).toBe(config.devServerPort);
});
});
7 changes: 1 addition & 6 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,7 @@ export async function readConfig(
path.join("public", "build")
);

if (typeof appConfig.devServerPort !== "number") {
appConfig.devServerPort = Number(
process.env.REMIX_DEV_SERVER_WS_PORT || 8002
);
}
let devServerPort = await getPort({ port: appConfig.devServerPort });
let devServerPort = Number(process.env.REMIX_DEV_SERVER_WS_PORT) || await getPort({ port: Number(appConfig.devServerPort) || undefined });
// set env variable so un-bundled servers can use it
process.env.REMIX_DEV_SERVER_WS_PORT = `${devServerPort}`;
let devServerBroadcastDelay = appConfig.devServerBroadcastDelay || 0;
Expand Down

0 comments on commit 1ab9745

Please sign in to comment.