Run Kubb with Vite#
kubb/vite runs Kubb as a Vite plugin. Add it to vite.config.ts. Pass your Kubb config to the config option.
Install#
Install kubb as a dev dependency.
::: code-group
bun add -d kubb
pnpm add -D kubb
npm install --save-dev kubb
yarn add -D kubb
:::
Configure#
Add the plugin to your vite.config.ts:
import kubb from 'kubb/vite'
import { defineConfig } from 'vite'
import { pluginTs } from '@kubb/plugin-ts'
const config = {
root: '.',
input: './petStore.yaml',
output: { path: './src/gen', clean: true },
plugins: [pluginTs({ output: { path: 'models' } })],
}
export default defineConfig({
plugins: [kubb({ config })],
})