move vue and vue-router to external#1066
Open
stackoverfloweth wants to merge 2 commits intovuejs:mainfrom
Open
move vue and vue-router to external#1066stackoverfloweth wants to merge 2 commits intovuejs:mainfrom
stackoverfloweth wants to merge 2 commits intovuejs:mainfrom
Conversation
✅ Deploy Preview for vue-devtools-docs canceled.
|
Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.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
When
@vue/devtools-kitbundles its type declarations via tsdown, it inlines the types fromvue-router(a devDependency). This causes vue-router'sdeclare module 'vue'augmentations — specifically theGlobalComponentsinterface withRouterViewandRouterLink— to be embedded indist/index.d.ts.This creates type conflicts for any library that also augments
GlobalComponentswith its ownRouterVieworRouterLinkcomponents (e.g. @kitbag/router). TypeScript's declaration merging requires subsequent property declarations to have the same type, so consumers see errors like:Caution
TS2717: Subsequent property declarations must have the same type. Property 'RouterView' must be of type '...' but here has type '...'
The same inlining also causes Vue's
Apptype to be duplicated asApp$1, leading to type mismatches when passingAppinstances tosetupDevtoolsPlugin.Fix
Add
external: ['vue', 'vue-router']to the tsdown config for@vue/devtools-kit. This prevents tsdown from inlining their type declarations into the bundled.d.tsoutput, keeping them as externalimport(...)references instead. Both packages are already devDependencies — their types should not be bundled.Test plan
@vue/devtools-kitand verifydist/index.d.tsno longer contains vue-router'sGlobalComponentsaugmentationGlobalComponentswith their own router components no longer getTS2717errors