An esbuild plugin that converts TypeScript path aliases defined in tsconfig.json's compilerOptions.paths to relative import paths during build. This avoids the need for runtime alias resolution, making output bundles self-contained and easier to distribute. Version 1.0.2 is the latest stable release with TypeScript type declarations and compatibility fixes. It works by hooking into esbuild's onLoad phase, rewriting static import statements that match the configured paths. Key differentiators: lightweight, zero runtime dependencies, focused solely on path transformation without affecting other esbuild behavior. Compared to alternatives like tsconfig-paths-webpack-plugin or vite-tsconfig-paths, this plugin is designed specifically for esbuild's streaming, fast build pipeline.
npm install esbuild-plugin-tsconfig-pathsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use the plugin with esbuild to resolve TypeScript path aliases during build, converting them to relative paths in the output.
Use static imports for paths defined in tsconfig.json, or handle dynamic resolution separately.
Set filter to /\.ts$/ or adjust if you need .tsx support (not officially supported).
Explicitly set baseUrl in tsconfig.json to the desired root directory.
Upgrade to v1.0.2 or later.
Install with 'npm install esbuild-plugin-tsconfig-paths --save-dev' and use ESM import syntax (import ... from ...). For CJS, use dynamic import: const { tsconfigPathsPlugin } = await import('esbuild-plugin-tsconfig-paths');Change to ESM import or use dynamic import as described above.
Provide a RegExp object: e.g., filter: /\.ts$/
No dependency data recorded yet.