---
title: "@farmfe/plugin-dts"
locale: "en"
version: "current"
canonicalUrl: "https://farmfe.org/docs/plugins/official-plugins/dts"
publicationStatus: "prerelease"
---

<a id="farmfeplugin-dts"></a>
# @farmfe/plugin-dts


Rust plugin that emits ` .d.ts ` files for matched TypeScript modules during a Farm build.


<a id="installation"></a>
## Installation


**npm**

```javascript
npm install @farmfe/plugin-dts
```


**yarn**

```javascript
yarn add @farmfe/plugin-dts
```


**pnpm**

```javascript
pnpm add @farmfe/plugin-dts
```



<a id="usage"></a>
## Usage


```ts
import { defineConfig } from "@farmfe/core";
import dts from "@farmfe/plugin-dts";

export default defineConfig({
  plugins: [
    dts({
      include: [".(ts|tsx)$"],
      exclude: ["node_modules/"],
    }),
  ],
});
```


<a id="options"></a>
## Options


- ` include?: string[] ` — regular expression strings for source modules to process. Defaults to ` [".(ts|tsx)$"] `.
- ` exclude?: string[] ` — regular expression strings for modules to skip. Defaults to ` ["node_modules/"] `.


The plugin writes ` .d.ts ` next to the matched module path in the emitted resources and rewrites import paths to ` .d.ts ` when they resolve through Farm aliases.



> [!NOTE]
> note
> 
> Currently only ` .d.ts ` output is supported for ` .ts ` and ` .tsx ` inputs.
