esbuild
unplugin-kubb/esbuild runs Kubb as an esbuild plugin. Add it to the plugins array in your build script. Pass your Kubb config to the config option.
Install
shell
bun add -d unplugin-kubb@betashell
pnpm add -D unplugin-kubb@betashell
npm install --save-dev unplugin-kubb@betashell
yarn add -D unplugin-kubb@betaConfigure
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 })],
})