An esbuild plugin that resolves TypeScript project references (composite projects) during bundling. Version 0.2.2 is the latest stable release, with no frequent updates. Unlike tsc --build which natively supports references, esbuild does not; this plugin fills that gap by reading tsconfig.json and package.json to map referenced packages to their output directories. It is lightweight and focuses solely on this task, with no dependencies beyond esbuild.
npm install esbuild-plugin-ts-referencesVerified import paths — ran on the pinned version, not inferred.
Shows minimal setup: import the plugin, call it in the esbuild plugins array, and bundle a TypeScript file with project references.
Ensure your project references are set up with relative paths in tsconfig.json and package.json.
Check that each referenced project has a rootDir and outDir specified in its tsconfig.json.
Keep esbuild version pinned within the supported range, or watch for plugin updates.
Restructure your project references to avoid circular dependencies.
Ensure all referenced projects are compiled to the same module format expected by the parent bundle.
Run 'npm install --save-dev esbuild-plugin-ts-references'
Use const tsReferences = require('esbuild-plugin-ts-references') for CJS or import tsReferences from 'esbuild-plugin-ts-references' for ESM.Verify that the referenced project is listed in tsconfig.json's references array and that its package.json exports the main field correctly.