diff --git a/.changeset/moody-pants-laugh.md b/.changeset/moody-pants-laugh.md
new file mode 100644
index 00000000000..640ba1b9ab6
--- /dev/null
+++ b/.changeset/moody-pants-laugh.md
@@ -0,0 +1,8 @@
+---
+"@remix-run/dev": major
+"@remix-run/react": major
+---
+
+remove deprecated REMIX_DEV_SERVER_WS_PORT env var
+
+use `remix dev`'s '`--port`/`port` option instead
diff --git a/packages/remix-dev/compiler/js/compiler.ts b/packages/remix-dev/compiler/js/compiler.ts
index 96ce26d6b3f..569a60ecb12 100644
--- a/packages/remix-dev/compiler/js/compiler.ts
+++ b/packages/remix-dev/compiler/js/compiler.ts
@@ -138,10 +138,6 @@ const createEsbuildConfig = (
"process.env.REMIX_DEV_ORIGIN": JSON.stringify(
ctx.options.REMIX_DEV_ORIGIN ?? ""
),
- // TODO: remove in v2
- "process.env.REMIX_DEV_SERVER_WS_PORT": JSON.stringify(
- ctx.config.devServerPort
- ),
...(ctx.options.mode === "production"
? {
"import.meta.hot": "undefined",
diff --git a/packages/remix-dev/compiler/server/compiler.ts b/packages/remix-dev/compiler/server/compiler.ts
index 0d88328231a..651a7064512 100644
--- a/packages/remix-dev/compiler/server/compiler.ts
+++ b/packages/remix-dev/compiler/server/compiler.ts
@@ -108,10 +108,6 @@ const createEsbuildConfig = (
publicPath: ctx.config.publicPath,
define: {
"process.env.NODE_ENV": JSON.stringify(ctx.options.mode),
- // TODO: remove in v2
- "process.env.REMIX_DEV_SERVER_WS_PORT": JSON.stringify(
- ctx.config.devServerPort
- ),
"process.env.REMIX_DEV_ORIGIN": JSON.stringify(
ctx.options.REMIX_DEV_ORIGIN ?? ""
),
diff --git a/packages/remix-react/__tests__/components-test.tsx b/packages/remix-react/__tests__/components-test.tsx
index 616a7de3c19..2f8435156d5 100644
--- a/packages/remix-react/__tests__/components-test.tsx
+++ b/packages/remix-react/__tests__/components-test.tsx
@@ -47,22 +47,14 @@ describe("", () => {
LiveReload = require("../components").LiveReload;
let { container } = render();
expect(container.querySelector("script")).toHaveTextContent(
- "url.port = undefined || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : Number(undefined) || 8002;"
+ "url.port = undefined || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002;"
);
});
it("can set the port explicitly", () => {
let { container } = render();
expect(container.querySelector("script")).toHaveTextContent(
- "url.port = 4321 || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : Number(undefined) || 8002;"
- );
- });
-
- it("determines the right port based on REMIX_DEV_SERVER_WS_PORT env variable", () => {
- process.env.REMIX_DEV_SERVER_WS_PORT = "1234";
- let { container } = render();
- expect(container.querySelector("script")).toHaveTextContent(
- "url.port = undefined || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : Number(1234) || 8002;"
+ "url.port = 4321 || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002;"
);
});
diff --git a/packages/remix-react/components.tsx b/packages/remix-react/components.tsx
index f4c6945a0b4..8cf47635673 100644
--- a/packages/remix-react/components.tsx
+++ b/packages/remix-react/components.tsx
@@ -1308,10 +1308,6 @@ export const LiveReload =
url.port =
${port} ||
REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port :
- Number(${
- // TODO: remove in v2
- process.env.REMIX_DEV_SERVER_WS_PORT
- }) ||
8002;
let ws = new WebSocket(url.href);