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
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