Conversation
pnpm resolves vite's optional @vitejs/devtools peer independently for each Nuxt-hosted devtools app and for @nuxt/kit's own dependency chain, so addVitePlugin ends up typed against a structurally distinct (but runtime-identical) vite install than the plugin objects we hand it. vue-tsc rejected this as a foreign Plugin instance after the vite 8.3.1 bump exposed the mismatch through the DevEnvironment hotUpdate hook.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
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.
Description
CI's
Typecheckstep is red onmain: after the vite 8.3.1 bump, pnpm resolves vite's optional@vitejs/devtoolspeer to a different published version for each Nuxt-hosted devtools app's own dependency chain versus the one@nuxt/kit'saddVitePluginis typed against. Both installs are the samevite@8.3.1, but TypeScript treats them as structurally distinct becauseDevEnvironment'shotUpdatehook now flows through a private_pluginContextMapfield, so vue-tsc rejects our own plugin objects as foreignPlugininstances inpackages/oxc,packages/rolldown, andpackages/vite'smodules/rpc.ts.Pinning the lockfile to a single
@vitejs/devtoolspeer flavor (viaoverrides,peerDependencyRules.allowedVersions, andignoreMissing) didn't hold — each Nuxt app instance re-resolves its own@nuxt/vite-builder→vite→@vitejs/devtoolschain independently, so a lockfile-level fix would mean pinning every such chain across the monorepo. Instead, this adds a smalladdDevToolsVitePluginhelper at eachaddVitePlugincall site that casts past the structural mismatch, since the plugin objects are valid at runtime regardless of which peer flavor typed them.Linked Issues
Additional context
Verified
pnpm lint && pnpm test && pnpm typecheck && pnpm buildall pass locally with this change (typecheck was the only broken step).This PR was created with the help of an AI agent.