Skip to content

feat(core): honor deploy base in static build - #555

Merged
antfu merged 1 commit into
mainfrom
feat/static-build-base
Sep 3, 2026
Merged

feat(core): honor deploy base in static build#555
antfu merged 1 commit into
mainfrom
feat/static-build-base

Conversation

@antfubot

@antfubot antfubot commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

What & why

Closes #554.

The static DevTools build hardcoded the absolute /__devtools/ mount path, so a snapshot deployed under a subpath (e.g. /ci-build-123456/) redirected the browser to /__devtools/ instead of /ci-build-123456/__devtools/ and failed to load. Setting Vite's base in vite.config.ts had no effect because the static-build code ignored it.

The CLI build command already declared a --base <baseURL> flag, but it was collected into BuildOptions.base and never used.

Change

Thread a deploy base through buildStaticDevTools so the two root-relative URLs it bakes resolve under the subpath:

  • the root index.html redirect, and
  • the dock-renderer import specifiers.

Wired from both entry points:

  • CLI path (vite-devtools build) — activates the existing --base flag.
  • Plugin path (vite build) — picks up resolvedConfig.base, so setting base in vite.config.ts now works.

The reference viewer's own assets, connection meta, and RPC dump already resolve relative (./) upstream, so they work under any base. Verified end-to-end: built with --base /ci-build-123456/, served under that subpath, and the SPA redirects correctly and renders with no load-blocking errors.

Scope

This makes the primary DevTools SPA work at a subpath. Full subpath support for the integration sub-panels (Rolldown/Vite/Oxc) is out of scope here: each Nuxt sub-app bakes its own absolute base at its own build time, and the devframe:docks dump carries absolute dock icon/url values whose derivation is owned upstream in @devframes/hub. Those warrant follow-up in the respective packages and upstream.

This PR was created with the help of an agent.

Thread the deploy base into buildStaticDevTools so the root redirect and
dock-renderer import specifiers resolve under a subpath instead of the
hardcoded /__devtools/. Activates the previously-unused --base CLI flag and
picks up Vite's resolvedConfig.base on the plugin build path.

Closes #554
@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

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

@vitejs/devtools-kit

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

@vitejs/devtools-oxc

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

@vitejs/devtools-rolldown

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

@vitejs/devtools-vite

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

@vitejs/devtools-vitest

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

commit: 7a6a242

@antfu
antfu merged commit e640296 into main Sep 3, 2026
10 checks passed
@antfu
antfu deleted the feat/static-build-base branch September 3, 2026 12:38
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.

Host static output at subpath

2 participants