Rollup
unplugin-kubb/rollup runs Kubb as a Rollup plugin. Generated files are written to disk in the buildStart hook, before the rest of the bundle runs.
Install
shell
bun add -d unplugin-kubbshell
pnpm add -D unplugin-kubbshell
npm install --save-dev unplugin-kubbshell
yarn add -D unplugin-kubbConfigure
typescript
import kubb from 'unplugin-kubb/rollup'
import { defineConfig } from 'kubb'
import { pluginTs } from '@kubb/plugin-ts'
const config = defineConfig({
root: '.',
input: { path: './petStore.yaml' },
output: { path: './src/gen', clean: true },
plugins: [pluginTs({ output: { path: 'models' } })],
})
export default {
input: 'src/index.ts',
plugins: [kubb({ config })],
}