---
url: /docs/5.x/guide/integrations/webpack.md
description: Run Kubb as part of your webpack build with kubb/webpack.
---

# Run Kubb with webpack

`kubb/webpack` runs Kubb during [webpack](https://webpack.js.org/) compilation. It requires webpack 5. Pass your Kubb config to the `config` option.

## Install

Install `kubb` as a dev dependency.

::: code-group

```shell [bun]
bun add -d kubb
```

```shell [pnpm]
pnpm add -D kubb
```

```shell [npm]
npm install --save-dev kubb
```

```shell [yarn]
yarn add -D kubb
```

:::

## Configure

Add the plugin to your `webpack.config.js`:

```javascript [webpack.config.js]
const kubb = require('kubb/webpack')
const { pluginTs } = require('@kubb/plugin-ts')

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

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