Skip to content

Commit b559cf6

Browse files
committed
fix: support mobile access when dev server binds to 0.0.0.0
- Vite server respects T3CODE_HOST for network binding - Skip hardcoded VITE_WS_URL when host is not localhost, letting the client derive WS URL from window.location - HMR auto-detects host when binding to 0.0.0.0
1 parent e895cf7 commit b559cf6

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

apps/web/vite.config.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { defineConfig } from "vite";
66
import pkg from "./package.json" with { type: "json" };
77

88
const port = Number(process.env.PORT ?? 5733);
9+
const host = process.env.T3CODE_HOST ?? "localhost";
910
const sourcemapEnv = process.env.T3CODE_WEB_SOURCEMAP?.trim().toLowerCase();
1011

1112
const buildSourcemap =
@@ -42,14 +43,12 @@ export default defineConfig({
4243
},
4344
server: {
4445
port,
46+
host,
4547
strictPort: true,
46-
hmr: {
47-
// Explicit config so Vite's HMR WebSocket connects reliably
48-
// inside Electron's BrowserWindow. Vite 8 uses console.debug for
49-
// connection logs — enable "Verbose" in DevTools to see them.
50-
protocol: "ws",
51-
host: "localhost",
52-
},
48+
hmr:
49+
host === "localhost"
50+
? { protocol: "ws", host: "localhost" }
51+
: { protocol: "ws" },
5352
},
5453
build: {
5554
outDir: "dist",

turbo.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"T3CODE_NO_BROWSER",
1212
"T3CODE_HOME",
1313
"T3CODE_AUTH_TOKEN",
14-
"T3CODE_DESKTOP_WS_URL"
14+
"T3CODE_DESKTOP_WS_URL",
15+
"T3CODE_HOST"
1516
],
1617
"tasks": {
1718
"build": {

0 commit comments

Comments
 (0)