百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
U

unplugin-isolated-decl

> 编程语言
开源

⚡️ 一款生成独立声明的快速工具。

193 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

⚡️ 一款生成独立声明的快速工具。

unplugin-isolated-decl

⚡️ A blazing-fast tool for generating isolated declarations.

Features

  • Fast: Generates .d.ts files significantly faster than tsc.
  • Transformer: Support Oxc, SWC, and TypeScript transformer.
  • Zero Config: No configuration required, works out of the box.
  • ✨ Bundler Support: Works with Vite, Rollup, esbuild and Farm.

[!TIP] For Rolldown users, you can use the rolldown-plugin-dts for a more powerful and flexible solution.

Installation

# npm
npm i -D unplugin-isolated-decl

# jsr
npx jsr add -D @unplugin/isolated-decl

Usage

Vite

// vite.config.ts
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/vite'

export default defineConfig({
  plugins: [UnpluginIsolatedDecl()],
})

Rollup

// rollup.config.js
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/rollup'

export default {
  plugins: [UnpluginIsolatedDecl()],
}

Rolldown

// rolldown.config.js
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/rolldown'

export default {
  plugins: [UnpluginIsolatedDecl()],
}

esbuild

// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [require('unplugin-isolated-decl/esbuild')()],
})

Farm

// farm.config.ts
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/farm'

export default defineConfig({
  plugins: [UnpluginIsolatedDecl()],
})

Options

…

rewriteImports

Rewrite imports in .d.ts files. (esbuild support is not available)

Here is an example of rewriting imports on Rollup:

// rollup.config.js
import alias from '@rollup/plugin-alias'

export default {
  // ...
  plugins: [
    alias({ entries: [{ find: '~', replacement: '.' }] }),
    UnpluginIsolatedDecl({
      rewriteImports(id, importer) {
        if (id[0] === '~') return `.${id.slice(1)}`
      },
    }),
    // ...
  ],
}

patchCjsDefaultExport

Patch export default in .d.cts to export =


[!NOTE] For the exhaustive set of options check options

Sponsors

License

MIT License © 2024-PRESENT Kevin Deng

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言