devtools icon indicating copy to clipboard operation
devtools copied to clipboard

devtools-oxc: overview fails with "Error: fetch failed" when npm.antfu.dev is unreachable

Open CaiPeng1989 opened this issue 1 month ago • 0 comments

Describe the bug

Opening the Oxc panel in Vite DevTools fails with Error: fetch failed when https://npm.antfu.dev/oxlint+oxfmt is unreachable from the Node process running vite / vp.

The Overview RPC (devtools-oxc:overview) does an unconditional remote fetch for latest-version comparison. If that request fails, the whole overview query fails and the panel cannot load — even though local Oxlint / Oxfmt (including Vite+ bundled versions) are available.

Reproduction

  1. Install @vitejs/devtools + @vitejs/devtools-oxc and enable devtools: { apply: 'serve' }.
  2. Block or fail access from Node to https://npm.antfu.dev (common with browser-only VPN / split tunneling / restricted networks).
  3. Run vp dev / vite and open the Oxc dock panel.

Expected

Overview should still render local toolchain info. Latest-version comparison should be best-effort and skipped on network failure.

Actual

Panel shows Error: fetch failed.

Relevant code

In @vitejs/devtools-oxc Overview RPC:

const [oxlintData, oxfmtData] = await (await fetch("https://npm.antfu.dev/oxlint+oxfmt")).json()

There is no try/catch around this call.

Suggested fix

Wrap the fetch in try/catch (and check response.ok). On failure, continue with local version info and skip / mark unknown the "latest" comparison.

Environment

CaiPeng1989 avatar Nov 03 '26 14:11 CaiPeng1989