Bug: DevToolsIntegration()'s 0.7.0 options shape isn't called correctly by Vite core
Describe the bug
0.7.0's changelog note "Resolve vite integration options within devtools" changed what DevToolsIntegration() expects as input:
// dist/integration.d.ts @ 0.7.1
interface DevToolsIntegrationConfig {
host?: string | boolean;
options: boolean | DevToolsConfig | undefined;
}
interface DevToolsIntegrationOptions {
command: 'serve' | 'build';
root?: string;
devtools: DevToolsIntegrationConfig;
}
declare function DevToolsIntegration(options: DevToolsIntegrationOptions): Promise<{ name: string }[]>;
Vite core still calls it the old way, at least through 8.2.2:
// vite/dist/node/chunks/node.js @ 8.2.2
async function loadDevToolsIntegrationPlugin(config) {
const { DevToolsIntegration } = await import("@vitejs/devtools/integration");
return DevToolsIntegration({ config });
}
0.6.1's own DevToolsIntegration$1(options) just did const config = options.config, which is why this never showed up before 0.7.0. Any project on @vitejs/devtools >= 0.7.0 with a current Vite (checked up to 8.2.2) gets:
TypeError: Cannot read properties of undefined (reading 'options')
❯ DevToolsIntegration$1 .../@vitejs/devtools/dist/integration.js:45:58
❯ loadDevToolsIntegrationPlugin .../vite/dist/node/chunks/node.js:30556:10
on every vite dev and vite build. #23302 widened the Vite-side peer range to allow devtools 0.5.0+, but didn't touch this call site, so the mismatch is still there.
Not sure which repo should carry the fix. On Vite's side it'd look roughly like:
async function loadDevToolsIntegrationPlugin(config) {
const { DevToolsIntegration } = await import("@vitejs/devtools/integration");
return DevToolsIntegration({
command: config.command,
root: config.root,
devtools: { options: config.devtools, host: config.server?.host },
});
}
Reproduction
pnpm add [email protected] @vitejs/[email protected].- Enable the Vite plugin (
devtools: { enabled: true }in Vite config, or any project using@vitejs/devtools's Vite integration). vite devorvite build.- It throws
TypeError: Cannot read properties of undefined (reading 'options')from insideDevToolsIntegration$1, before the server/build even starts.
System Info
System:
OS: macOS 26.5.1
CPU: (11) arm64 Apple M3 Pro
Memory: 79.97 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.20.0
npm: 11.19.0
pnpm: 11.22.0
bun: 1.3.14
Browsers:
Chrome: 152.0.7977.65
Safari: 26.5
Used package manager
pnpm
We made significant changes to the Vite core integration in v0.7 and plan to integrate it into Vite v8.3. Sorry for the breaking changes in this release. Before Vite v8.3.0 is released, I think it would be better to pin DevTools to v0.6.x for now.