Vite plugin
@deltabox/toolchain ships the dbx() Vite/Vite+ plugin. It carries the whole toolchain config inline, so a Vite project does not need a dbx.config.*, and it runs dbx sync before dev/build (or dbx sync --check in CI).
The plugin is published from the
@deltabox/toolchain/vitesubpath. The standalonevite-plugin-dbxpackage is not published yet, so import@deltabox/toolchain/vite(notvite-plugin-dbx) until it ships.
Install
yarn add -D @deltabox/toolchainA Vite+ project also needs vite-plus (which provides vp, Vite, Vitest, Oxfmt and Oxlint); see Vite+.
Use
// vite.config.ts
import { defineConfig } from 'vite-plus'; // or 'vite'
import { dbx, DBX_TASKS } from '@deltabox/toolchain/vite';
export default defineConfig({
plugins: [
dbx({
toolchain: {
project: { name: 'my-app', scope: '@org' },
fmt: true,
lint: true,
// ...any other dbx sections
},
}),
],
run: { tasks: { ...DBX_TASKS } },
});What it does
- Loads the inline
toolchainconfig (merged over a nearbydbx.config.*when one exists). - Runs
dbx syncbefore the dev server / build, ordbx sync --checkwhenCIis set. - Re-syncs when a dbx input file changes in watch mode.
- Derives Vite options from the dbx sections:
logger→logLevel/customLogger,watch→server.watch, andfmt/lint→ the Vite+ formatter/linter (only whenvite-plusis installed). - Exposes
DBX_TASKS(dbx:sync,dbx:check) forrun.tasks/vp run.
In a workspace, leave fmt and lint out of the plugin config: the root vite.config.* owns them and Vite+ applies the root options to the workspace. fmt: true / lint: true there would select the shared defaults instead.
See Vite+ for the full Vite+ integration, the Vite+ provider and the toolchain.vite options, and the configuration reference for every section.