Skip to content

fix(core): declare client module resolution before plugin setup - #582

Merged
antfu merged 1 commit into
vitejs:mainfrom
morinokami:fix/client-module-resolution-before-setup
Sep 25, 2026
Merged

antfu merged 1 commit into
vitejs:mainfrom
morinokami:fix/client-module-resolution-before-setup

Conversation

@morinokami

Copy link
Copy Markdown
Contributor

Description

A plugin that registers a dock with a bare-specifier client script inside devtools.setup() (e.g. action: { importFrom: 'my-plugin/devtools-action' }, as the Kit docs show) gets a false DF8111 warning ("the script will fail to load") on the dev server, although the script loads fine through /@id/.

The hub checks staticConfig.dock.clientModuleResolution inside docks.register(), but core only declared it via initHub() in createDevToolsHub, which runs after createDevToolsContext has already run every plugin's setup().

This declares the template in createDevToolsContext, before any dock registers. It stays dev-server only, so build / standalone keep warning as before. initHub still receives the same value, which covers contexts assembled elsewhere.

Linked Issues

Mentioned in passing in devframes/devframe#289 ("fires even in plain Vite, where the dock works fine"), which was closed without addressing it.

Additional context

  • Reproducible with vite-plugin-vue-tracer (viteDevtools: true): published 0.7.5 prints 1 warning, this branch prints 0. The advertised clientModuleResolution and the /@id/… response (200) are identical in both.
  • The added test fails without the fix.

@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@582

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@582

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@582

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@582

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@582

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@582

commit: f836a78

@antfu
antfu merged commit 006b09f into vitejs:main Sep 25, 2026
7 checks passed
morinokami added a commit to morinokami/astro-devtools that referenced this pull request Sep 27, 2026
The Astro docks name their renderer by the bare specifier
"astro-devtools/client", which the dev server loads through Vite's
`/@id/` resolution. Up to 0.7.5, Vite DevTools declared that
resolution only in `initHub()`, after every plugin's
`devtools.setup()` had run, so each dock registration warned DF8111
("the script will fail to load") about a script that loads fine.
`setup()` worked around it by writing the template into
`staticConfig.dock` itself.

Vite DevTools 0.7.6 declares the template in `createDevToolsContext`,
before any plugin setup runs (vitejs/devtools#582):

- Bump the six `@vitejs/devtools-*` entries of the `devtools` catalog
  to 0.7.6. The devframe family stays at 1.0.0, which upstream's own
  v0.7.6 lockfile also resolves; devframe 1.1.0 is left for a bump of
  its own.
- Drop the workaround from `setup()`.
- Raise the `@vitejs/devtools` and `@vitejs/devtools-kit` peer ranges
  to ^0.7.6. Without the workaround, 0.7.5 prints DF8111 once per
  custom-render dock.
- Rename the e2e test that looks for DF8111 in the server log: the
  integration no longer declares the resolution, but the test still
  guards the peer floor.


Claude-Session: https://claude.ai/code/session_01DLDVYeDh6abCj8w9TxSXUQ

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants