Repository navigation
fix: load the graph again in production builds - #202
Merged
Merged
Conversation
Since the Vite 8.3 upgrade (#196), a `?worker&url` asset imported from inside a worker is no longer written out. The notes worker imports the subwaytext parser that way, so a production build kept a URL to a file that did not exist: the parser workers failed to start, and every graph read — the note list first — rejected with `undefined`. The dev server, and with it the Playwright suite, was unaffected. Start the parser pool with `new Worker(new URL(…, import.meta.url))`, the form Vite resolves itself, and fail the build whenever an emitted script refers to an asset that is missing, so the next upgrade that drops one is caught at build time. Co-Authored-By: Claude Opus 5.5 <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
Since the Vite 8.3 upgrade (#196), a production build cannot load a graph: the note list spins forever. The notes worker starts the subwaytext parser pool from a
?worker&urlimport, and Vite 8.3 no longer writes that asset out when it is imported from inside a worker. The URL points at a file that does not exist, the parser workers never start, and every graph read rejects withundefined. The dev server, and with it the Playwright suite, is unaffected.vite.config.tsgainsreferencedScriptsExistPlugin: after writing the bundle, it fails the build if any emitted script refers to an/assets/*.jsfile that was not written. CLAUDE.md notes the trap next to the existingMessagePort.start()gotcha.Evidence
npm run buildonmainemitsassets/index-B2ja9r7W.js(the notes worker) referring to/assets/index-Cjb8p4yi.js, which is not indist/. In the built app, the renderer log showsFailed to load module script: … MIME type of "text/plain"(the 404) andUncaught (in promise) Error: undefinedfromgetNotesList, and the note list never loads. The commit before chore(deps-dev): bump vite from 8.0.16 to 8.3.5 #196 (Vite 8.0.16) emits the file; Vite 8.3.5 does not.With the new guard and the old import, the build fails:
The build refers to scripts it did not write: assets/index-Cjb8p4yi.js (referenced by assets/index-B4hWaYhT.js).neno://, launched with Playwright's Electron driver against a scratch graph) lists the graph's notes.npm run test(367 tests),npm run lint,npm run buildandnpm run integration-test(65 tests) pass.Merge Danger
Door: two-way
One import replaced, one build check added; revert the commit to undo.
Blast Radius: build
The new check fails a build that refers to a missing script, so a future dependency bump that drops an asset fails CI instead of shipping. Only
/assets/*.jsreferences in emitted scripts are checked.🤖 Generated with Claude Code