Summary
On a self-hosted instance started with npm run serve, the document editor never boots — it hangs at "Loading editor…". The built editor bundle produced by npm run build is written to dist/, but the server only serves static assets from public/, so /assets/editor.js returns 404.
Environment
- Self-hosted,
npm run serve (API + editor on :4000)
- Accessed via
http://localhost:4000/d/<slug>?token=<accessToken>
- Version:
fb25787 ("Sync Proof SDK with latest shared collab fixes")
Root cause
npm run build = vite build && node scripts/finalize-web-build.mjs. Vite emits the bundle to dist/assets/editor.js, and dist/index.html references <script defer src="./assets/editor.js">.
server/share-web-routes.ts:600 serves the SPA by reading dist/index.html and rewriting "./ → "/, so the browser requests /assets/editor.js.
- But
server/index.ts:49 mounts only public/:
app.use(express.static(path.join(__dirname, '..', 'public')));
There is no static mount for dist/, and scripts/finalize-web-build.mjs does not copy dist/assets/* into public/ (it only rewrites index.html and writes a manifest).
- Net:
/assets/editor.js (and the presence-color PNGs blue.png, lime.png, …) live in dist/assets/ but are never served → 404 → the SPA shell loads but the editor JS never does.
Reproduction
git clone https://github.com/EveryInc/proof-sdk && cd proof-sdk
npm install && npm run build && npm run serve
# create a doc
curl -sS -X POST http://localhost:4000/documents -H 'Content-Type: application/json' \
-d '{"title":"t","markdown":"# hi"}'
# the bundle the editor needs:
curl -i http://localhost:4000/assets/editor.js # -> HTTP/1.1 404
ls dist/assets/editor.js # -> exists (2.8 MB)
ls public/assets/editor.js # -> No such file
Open /d/<slug>?token=… in a browser → stuck at "Loading editor…".
Suggested fix
Either:
- Mount the build output in
server/index.ts (one line), e.g.
app.use(express.static(path.join(__dirname, '..', 'public')));
app.use(express.static(path.join(__dirname, '..', 'dist'))); // serve built bundle
(public stays authoritative; dist fills the editor.js gap and stays fresh after every build), or
- Have
scripts/finalize-web-build.mjs copy dist/assets/* (and the favicons) into public/assets/.
Option 1 is preferable since it avoids stale copies after rebuilds.
Found while debugging a self-hosted instance with Claude Code.
Summary
On a self-hosted instance started with
npm run serve, the document editor never boots — it hangs at "Loading editor…". The built editor bundle produced bynpm run buildis written todist/, but the server only serves static assets frompublic/, so/assets/editor.jsreturns 404.Environment
npm run serve(API + editor on:4000)http://localhost:4000/d/<slug>?token=<accessToken>fb25787("Sync Proof SDK with latest shared collab fixes")Root cause
npm run build=vite build && node scripts/finalize-web-build.mjs. Vite emits the bundle todist/assets/editor.js, anddist/index.htmlreferences<script defer src="./assets/editor.js">.server/share-web-routes.ts:600serves the SPA by readingdist/index.htmland rewriting"./→"/, so the browser requests/assets/editor.js.server/index.ts:49mounts onlypublic/:dist/, andscripts/finalize-web-build.mjsdoes not copydist/assets/*intopublic/(it only rewritesindex.htmland writes a manifest)./assets/editor.js(and the presence-color PNGsblue.png,lime.png, …) live indist/assets/but are never served → 404 → the SPA shell loads but the editor JS never does.Reproduction
Open
/d/<slug>?token=…in a browser → stuck at "Loading editor…".Suggested fix
Either:
server/index.ts(one line), e.g.editor.jsgap and stays fresh after every build), orscripts/finalize-web-build.mjscopydist/assets/*(and the favicons) intopublic/assets/.Option 1 is preferable since it avoids stale copies after rebuilds.
Found while debugging a self-hosted instance with Claude Code.