esbuild-plugin-decorators (v0.0.3) is an esbuild plugin that enables support for experimental ECMAScript decorators. It patches the esbuild build process to transform decorators using the TypeScript compiler API. This plugin is intended for projects that rely on legacy decorator syntax (e.g., from TypeScript's experimentalDecorators or Babel) and need to bundle with esbuild, which does not natively support decorators. The plugin is minimal and has no dependencies beyond esbuild and TypeScript. However, it is experimental and not actively maintained; the latest version (0.0.3) was released in early 2023. Compared to alternatives like esbuild-plugin-babel or esbuild-plugin-typescript-decorators, this one is a lightweight wrapper but lacks comprehensive error handling and documentation. Use with caution in production.
npm install esbuild-plugin-decoratorsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to bundle TypeScript with experimental decorators using esbuild and the plugin.
Install esbuild: npm install esbuild
Install typescript: npm install typescript; set experimentalDecorators in tsconfig.json
Consider using esbuild-plugin-babel or esbuild-plugin-typescript-decorators as more maintained alternatives.
If source maps are important, consider a plugin that integrates Babel instead.
Ensure your entry points use ES module syntax.
npm install esbuild-plugin-decorators
Add "experimentalDecorators": true to tsconfig.json compilerOptions
Use import decoratorsPlugin from 'esbuild-plugin-decorators' (default import)
Update esbuild to version >=0.10 with npm update esbuild