Skip to content

feat: add build.withApp option to auto-generate static devtools#249

Merged
antfu merged 2 commits intomainfrom
antfu/build-with-app
Mar 24, 2026
Merged

feat: add build.withApp option to auto-generate static devtools#249
antfu merged 2 commits intomainfrom
antfu/build-with-app

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented Mar 23, 2026

Description

This PR adds a build.withApp option to the DevTools plugin that automatically generates static DevTools output when running vite build. Previously, static output required a separate vite-devtools build CLI command which lost build-time plugin data. Now users can set withApp: true to capture real build data in the static output.

Key changes:

  • Extract build logic into reusable buildStaticDevTools() function (build-static.ts)
  • Add DevToolsBuild Vite plugin that runs during vite build in the closeBundle hook
  • Add build: { withApp?: boolean, outDir?: string } option to DevToolsOptions
  • Refactor CLI build() command to use the extracted function

…vite build

Extract build logic into reusable `buildStaticDevTools()` function and create a
`DevToolsBuild` Vite plugin that runs during `vite build` to generate static
DevTools output in the `closeBundle` hook, reusing the same context and capturing
real build data. Adds `build: { withApp?: boolean, outDir?: string }` option to
DevToolsOptions.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 23, 2026

Open in StackBlitz

@vitejs/devtools

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

@vitejs/devtools-kit

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

@vitejs/devtools-rolldown

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

@vitejs/devtools-rpc

npm i https://pkg.pr.new/@vitejs/devtools-rpc@249

@vitejs/devtools-self-inspect

npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@249

commit: 841ee51

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@antfu antfu merged commit 22621ca into main Mar 24, 2026
9 checks passed
@antfu antfu deleted the antfu/build-with-app branch March 24, 2026 01:42
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.

1 participant