esbuild plugin for compiling TypeScript declaration files (.d.ts) with automatic path alias resolution. Current stable version: 4.2.0 (June 2023). Release cadence: irregular, with major version bumps for esbuild and TypeScript peer dependency updates. Key differentiators: integrates directly into esbuild build pipeline, transforms path aliases like @utils/foo to relative imports in emitted .d.ts files, supports custom tsconfig and output paths. Requires esbuild ^0.17.0 || ^0.18.0 and TypeScript >=5.0, Node >=16.10.0. The plugin resolves tsconfig paths, runs TypeScript compiler for declaration emit, then rewrites alias imports to relative paths. Ships TypeScript types and is ESM-only.
npm install esbuild-plugin-d-ts-path-aliasNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates minimal usage: import plugin, pass to esbuild build call with entry point and output file.
Use import statement or dynamic import(). If you need CommonJS, stay on v3.x.
Update TypeScript to >=5.0 and esbuild to ^0.17.0 or higher.
Explicitly set outputPath in plugin config to avoid ambiguity.
Upgrade to v3.x or later to support TypeScript >=5.0.
Ensure tsconfig.json includes paths mapping, e.g., "@utils/*": ["./src/utils/*"].
Change to import { dTSPathAliasPlugin } from 'esbuild-plugin-d-ts-path-alias' or use dynamic import.Ensure package is installed and import statement uses named export: import { dTSPathAliasPlugin } from 'esbuild-plugin-d-ts-path-alias'.Create a tsconfig.json or pass a custom path: dTSPathAliasPlugin({ tsconfigPath: './config/tsconfig.json' }).Set outdir or outfile in esbuild build options, or provide outputPath in plugin config.