Skip to content

Farm

unplugin-kubb/farm runs Kubb as a Farm plugin. Farm is a Rust-based web build tool with Vite-compatible plugin API.

Install

shell
bun add -d unplugin-kubb
shell
pnpm add -D unplugin-kubb
shell
npm install --save-dev unplugin-kubb
shell
yarn add -D unplugin-kubb

Configure

farm.config.ts
typescript
import { defineConfig as defineFarmConfig } from '@farmfe/core'
import kubb from 'unplugin-kubb/farm'
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 defineFarmConfig({
  plugins: [kubb({ config })],
})