Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content

Rspack

unplugin-kubb/rspack runs Kubb during Rspack compilation. Rspack is a Rust-based bundler with a webpack-compatible config. Pass your Kubb config to the config option.

Install

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

Configure

rspack.config.js
javascript
const kubb = require('unplugin-kubb/rspack')
const { defineConfig } = require('kubb')
const { pluginTs } = require('@kubb/plugin-ts')

const config = defineConfig({
  root: '.',
  input: { path: './petStore.yaml' },
  output: { path: './src/gen', clean: true },
  plugins: [pluginTs({ output: { path: 'models' } })],
})

module.exports = {
  plugins: [kubb({ config })],
}