Repository navigation
Conversation
In extension development mode the webview HTML is fetched from the vite dev server (127.0.0.1:5739). When that server is not running - or its port cannot be bound (e.g. blocked by OS port exclusions) - every office file open fails: resolveCustomEditor rejects with ECONNREFUSED and the editor shows 'Unable to open ... Assertion Failed' errors. - Extract a resolveWebviewContent contract: serve dev content when reachable, otherwise fall back to the last production build in out/webview - Keep the base URL consistent with the chosen source so fallback pages load assets from the webview CDN instead of the dead dev server - Add unit tests covering dev, fallback, and production paths
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.
Problem
In extension development mode (
IS_DEV), the webview HTML is fetched from the vite dev server at127.0.0.1:5739. When that server is not running — or its port cannot be bound at all (e.g. Windows reserved port ranges covering 5739 yieldEACCESonlisten) — every office file open fails:resolveCustomEditorrejects withECONNREFUSEDand the editor shows "Unable to open ... Assertion Failed" style errors.This is easy to hit because the F5
preLaunchTask(npm run dev) starts the esbuild watch and the vite dev server together: the watch succeeds and the task completes, so the Extension Development Host launches even though the dev server is dead.Fix
resolveWebviewContentcontract (src/common/webviewContent.ts): serve dev content when reachable, otherwise fall back to the last production build inout/webview.<base>URL consistent with the chosen source via afromDevServerflag, so fallback pages load assets from the webview CDN instead of the dead dev server.Normal dev workflow (server up) and production mode behavior are unchanged.
Notes
out/webviewto exist (i.e.npm run buildhas run at least once). In a fresh clone where only the dev server is expected, a dead server still fails the open — same as before this change.test:unitusesnode --testwith TypeScript type stripping and needs Node >= 22.6 locally; CI (Node 20) does not run it.