Skip to content

fix(core): start standalone DevTools once for multi-environment builds - #613

Merged
webfansplz merged 1 commit into
vitejs:mainfrom
RaphaelFakhri:fix/run-devtools-once
Oct 19, 2026
Merged

webfansplz merged 1 commit into
vitejs:mainfrom
RaphaelFakhri:fix/run-devtools-once

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Description

runDevTools() looped over the selected build environments and called startDevTools() once per environment, without using the loop variable. Each call starts an identical standalone server for the whole project, so vite build with client + ssr environments started two DevTools servers on ports 9999 and 10000.

This change starts the standalone server once when at least one selected environment exists. When environments selects none, nothing starts, as before.

A new test in packages/core/src/node/__tests__/integration.test.ts runs runDevTools() with client and ssr environments and expects one startDevTools() call. It fails on main (called 2 times) and passes with this change.

Linked Issues

Fixes #612

Additional context

Checked end to end by calling Vite's createBuilder() and buildApp() on a project with client and ssr environments, then runDevTools(builder): the published 0.7.6 build prints two "Vite DevTools started at" lines, the patched build prints one.

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

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

@vitejs/devtools-kit

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

@vitejs/devtools-oxc

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

@vitejs/devtools-rolldown

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

@vitejs/devtools-vite

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

@vitejs/devtools-vitest

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

commit: 21f8b02

@webfansplz
webfansplz merged commit 44e47f0 into vitejs:main Oct 19, 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.

vite build starts one standalone DevTools server per build environment

2 participants