Skip to content

Run Kubb with Rollup

kubb/rollup runs Kubb as a Rollup plugin. It writes the generated files in the buildStart hook, before the rest of the bundle runs. Pass your Kubb config to the config option.

Install

Install kubb as a dev dependency.

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

Configure

Add the plugin to your rollup.config.ts:

rollup.config.ts
typescript
import  from 'kubb/rollup'
import {  } from '@kubb/plugin-ts'

const  = {
  : '.',
  : './petStore.yaml',
  : { : './src/gen', : true },
  : [({ : { : 'models' } })],
}

export default {
  : 'src/index.ts',
  : [({  })],
}