---
extractApiHeaders: [2]
---

# Builder Types

This section describes some of the type definitions provided by the Builder.

## BuilderInstance

The type of the Builder instance.

```ts
import type { BuilderInstance } from '@modern-js/builder';

let builder: BuilderInstance;
```

You can pass in the Provider type through generics to make the type definition of the Builder instance more accurate:

```ts
import type { createBuilder, type BuilderInstance } from '@modern-js/builder';
import type { BuilderWebpackProvider } from '@modern-js/builder-webpack-provider';

let builder: BuilderInstance<BuilderWebpackProvider>;
```

## BuilderContext

The type of the context property in the Builder instance.

```ts
import type { BuilderContext } from '@modern-js/builder';

const context: BuilderContext = builder.context;
```

## BuilderPlugin

The type of Builder plugin, should be used with the `BuilderPluginAPI` type exported from the provider.

```ts
import type { BuilderPlugin } from '@modern-js/builder';
import type { BuilderPluginAPI } from '@modern-js/builder-webpack-provider';

const myPlugin: BuilderPlugin<BuilderPluginAPI> = {
  name: 'my-plugin',
  setup() {},
};
```

## BuilderTarget

The type of build target.

```ts
import type { BuilderTarget } from '@modern-js/builder';
```

## BuilderEntry

The type of the `entry` option to the `createBuilder` method.

```ts
import type { BuilderEntry } from '@modern-js/builder';
```

## CreateBuilderOptions

The param type of `createBuilder` method.

```ts
import type { CreateBuilderOptions } from '@modern-js/builder';
```
