Repository navigation
fix(vscode): skip hot-swap when TypeScript exports are getter-only - #6374
Merged
johnsoncodehk merged 2 commits intoDec 3, 2026
Merged
Conversation
VS Code bundles the TypeScript extension with esbuild since 1.110, so its exports are getter-only properties and `Object.assign` throws while that extension is still loading. Bail out instead and ask for a host restart.
johnsoncodehk
pushed a commit
that referenced
this pull request
Dec 3, 2026
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.
When the extension host restarts with a
.tsfile as the active editor,vscode.typescript-language-featuresactivates first ononLanguage:typescriptand the Vue extension is loaded while that activation is still in flight.patchTypeScriptExtension()only returns early when the TypeScript extensionisActive, which is stillfalseat that point, so it takes the hot-swap path for an already loaded module. The whole Vue extension then fails to load withTypeError: Cannot set property activate of #<Object> which has only a getter, and the restart prompt never appears.The hot-swap was added in #5260, back when the TypeScript extension was bundled with webpack and its exports were writable data properties. It is now bundled with esbuild, so
module.exportscomes from__toCommonJSand every export is an enumerable getter without a setter;Object.assignwrites through[[Set]]and therefore always throws. The block moves intoreloadModuleExports()inregisterModuleTransform.ts, which inspects the property descriptors first and returnsfalsewhen the exports cannot be assigned, leaving the existing "Please restart the extension host to activate Vue support." prompt to handle the race. Only enumerable own properties are inspected, the same onesObject.assignwould write, so the non-enumerable__esModulemarker that tsc emits for CommonJS is ignored and writable exports still get swapped in place as before.fix #6373