An esbuild plugin that automatically generates TypeScript declaration files (.d.ts/.d.tsx) during the build process. Current stable version is 0.9.26. It integrates seamlessly with esbuild (peer dependency >=0.27.4) and focuses on speed—leveraging the Rust-based `oxc` resolver for fast type emission. Unlike alternatives like `tsc` or `rollup-plugin-dts`, this plugin is purpose-built for esbuild users who want DTS generation as part of their build pipeline without sacrificing build performance. It is part of the Stacks ecosystem and actively maintained with regular releases.
npm install esbuild-plugin-dtsxNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: build TypeScript entry with esbuild and auto-generate DTS files in the output directory.
Use the Node.js API (esbuild.build) for plugin integration.
Ensure project is configured for ESM (e.g., `"type": "module"` in package.json).
Remove `declarationDir` from plugin options; set `outdir` in esbuild options directly.
Ensure all needed types are imported via entry points or use tsconfig `include` pattern.
Use `tsconfig.json`'s `paths` and `baseUrl` correctly; consider bundling external types.
Call the function: plugins: [dtsPlugin()]
Install the package: npm i -D esbuild-plugin-dtsx. If using CommonJS, use dynamic import: const dtsPlugin = (await import('esbuild-plugin-dtsx')).default;Update TypeScript to >=4.5 or configure tsconfig to remove experimental decorators.