esbuild
unplugin-kubb/esbuild runs Kubb as an esbuild plugin. Pass it to the plugins array in your build script.
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 { build } from 'esbuild'
import kubb from 'unplugin-kubb/esbuild'
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' } })],
})
await build({
entryPoints: ['src/index.ts'],
bundle: true,
outfile: 'dist/bundle.js',
plugins: [kubb({ config })],
})