devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Devtools started link is invalid when server host is set to IPv6 address

Open AFCMS opened this issue 8 months ago • 0 comments

Describe the bug

Setting server host to a IPv6 address (ex: localhost) lead to a broken link when launching devtools:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  server: {
    host: '::1',
  },
  devtools: {
    enabled: true,
  }
})

pnpm run dev (proper IPv6 URL):

  VITE v8.0.0  ready in 79 ms

  ➜  Local:   http://[::1]:5173/
  ➜  press h + enter to show help

pnpm run build:

vite v8.0.0 building client environment for production...
✓ 20 modules transformed.
computing gzip size...
dist/index.html                   0.46 kB │ gzip:  0.30 kB
dist/assets/react-CHdo91hT.svg    4.12 kB │ gzip:  2.06 kB
dist/assets/vite-BF8QNONU.svg     8.70 kB │ gzip:  1.60 kB
dist/assets/hero-5sT3BiRD.png    44.91 kB
dist/assets/index-D64VDMd1.css    4.10 kB │ gzip:  1.47 kB
dist/assets/index-Bc2oaLMj.js   193.32 kB │ gzip: 60.66 kB

✓ built in 159ms
[Vite DevTools] Client authentication is disabled. Any browser can connect to the devtools and access to your server and filesystem.
⬢ Vite DevTools started at http://::1:9999 

The displayed http://::1:9999 isn't a valid IPv6 URL, devtools can be properly accessed at http://[::1]:9999 as expected.

Reproduction

https://stackblitz.com/edit/vitejs-vite-devtools-ipv6-repro

System Info

System:
    OS: Linux 6.19 Fedora Linux 43 (Workstation Edition)
    CPU: (32) x64 AMD Ryzen 9 9950X3D 16-Core Processor
    Memory: 45.29 GB / 62.33 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 24.11.0 - /home/afcm/.nvm/versions/node/v24.11.0/bin/node
    Yarn: 1.22.22 - /home/afcm/.nvm/versions/node/v24.11.0/bin/yarn
    npm: 11.11.1 - /home/afcm/.nvm/versions/node/v24.11.0/bin/npm
    pnpm: 10.32.1 - /home/afcm/.nvm/versions/node/v24.11.0/bin/pnpm
    bun: 1.3.10 - /home/afcm/.bun/bin/bun
    Deno: 2.7.5 - /home/afcm/.deno/bin/deno
  Browsers:
    Brave Browser: 146.1.88.130
    Chrome: 146.0.7680.75
    Firefox: 148.0.2
    Firefox Developer Edition: 148.0.2

Used Package Manager

pnpm

Validations

  • [x] Follow our Code of Conduct
  • [x] Read the Contributing Guide.
  • [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [x] The provided reproduction is a minimal reproducible of the bug.

AFCMS avatar Mar 15 '26 15:03 AFCMS