From 1f639511e1f1da656ad574aa15f9afa7613bb095 Mon Sep 17 00:00:00 2001 From: michael-ford Date: Thu, 9 Apr 2026 08:18:52 -0700 Subject: [PATCH] Fix self-hosted editor: serve dist/ assets and default COLLAB_EMBEDDED_WS Two issues prevent the editor from loading in local self-hosted mode: 1. The server reads dist/index.html for the SPA shell but does not mount express.static for dist/, so the built JS bundle (assets/editor.js) returns 404. 2. Without COLLAB_EMBEDDED_WS=1, the collab-session endpoint returns a WebSocket URL on port+1 (e.g. 4001) even though the embedded runtime multiplexes WebSocket connections on the main HTTP port (4000). The editor connects to a non-existent server and never syncs document content. --- .env.example | 4 ++++ server/index.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/.env.example b/.env.example index 0d1ec67..dedb026 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,7 @@ VITE_ENABLE_TELEMETRY=false # Optional app version tag for event properties VITE_APP_VERSION=dev + +# Required for local self-hosted mode: multiplexes WebSocket collab on the +# main HTTP port instead of port+1. +COLLAB_EMBEDDED_WS=1 diff --git a/server/index.ts b/server/index.ts index c12a13c..3bb75b4 100644 --- a/server/index.ts +++ b/server/index.ts @@ -47,6 +47,7 @@ async function main(): Promise { app.use(express.json({ limit: '10mb' })); app.use(express.static(path.join(__dirname, '..', 'public'))); + app.use(express.static(path.join(__dirname, '..', 'dist'))); app.use((req, res, next) => { const originHeader = req.header('origin');