Fix local dev server: serve dist/ assets and fix WebSocket port#30
Open
konovenski wants to merge 1 commit intoEveryInc:mainfrom
Open
Fix local dev server: serve dist/ assets and fix WebSocket port#30konovenski wants to merge 1 commit intoEveryInc:mainfrom
konovenski wants to merge 1 commit intoEveryInc:mainfrom
Conversation
Two issues prevented `npm run build && npm run serve` from working out of the box: 1. The Express server only served static files from `public/` but not from `dist/`, so the built `editor.js` bundle returned 404. 2. `startCollabRuntimeEmbedded` sets `wsUrlBase` to the main HTTP port (e.g. ws://localhost:4000/ws) but `resolveRequestScopedCollabWsBase` did not know the runtime was embedded. Without the COLLAB_EMBEDDED_WS flag, it computed the collab URL as port+1 (4001), causing WebSocket connection refused errors and a perpetual "Connecting" state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two issues prevented
npm run build && npm run servefrom working out of the box for local development:dist/: The Express server only served files frompublic/but the builteditor.jsbundle lives indist/assets/, returning 404 and showing a white screen.startCollabRuntimeEmbeddedcorrectly setswsUrlBasetows://localhost:4000/ws, butresolveRequestScopedCollabWsBasedidn't know the runtime was embedded. Without theCOLLAB_EMBEDDED_WSflag, it computed port+1 (4001) for the collab WebSocket URL, causing connection refused errors and a perpetual "Connecting" state.Changes
server/index.ts: Addexpress.staticfor thedist/directory so built assets are servedserver/collab.ts: SetCOLLAB_EMBEDDED_WS=1instartCollabRuntimeEmbeddedso the request-scoped URL resolver uses the correct portTest plan
npm install && npm run build && npm run servePOST /documentsto create a doc, then navigate to the returned URLnpm run dev(Vite) still works correctly for development🤖 Generated with Claude Code