diff --git a/rsbuild.config.ts b/rsbuild.config.ts index a714e9d..a63ecb6 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -46,7 +46,7 @@ export default defineConfig({ "/__CONTENT_INDEX.json": "http://localhost:3000", "/__COMPLETIONS.json": "http://localhost:3000", "/content": "http://localhost:3000", - "/journal": "http://localhost:3000", + "/.ttrpg": "http://localhost:3000", }, }, output: { diff --git a/src/components/journal/ConnectDialog.tsx b/src/components/journal/ConnectDialog.tsx index 052c747..797737a 100644 --- a/src/components/journal/ConnectDialog.tsx +++ b/src/components/journal/ConnectDialog.tsx @@ -40,7 +40,12 @@ export const ConnectDialog: Component = () => { const name = playerName().trim() || stream.myName; if (!name) return; - const brokerUrl = `ws://${window.location.host}`; + // In dev, the MQTT broker lives on the CLI server (port 3000), not the + // rsbuild dev server. In production, the CLI serves everything itself. + const brokerUrl = + process.env.NODE_ENV === "development" + ? `ws://localhost:3000` + : `ws://${window.location.host}`; setConnecting(true); setError(null);