An esbuild plugin that enables importing and bundling CoffeeScript (.coffee, .litcoffee) files directly within esbuild builds. Current stable version is 3.1.0, updated regularly (multiple releases per year), peer dependency on esbuild >=0.25.9. Key differentiators: integrates CoffeeScript compilation directly into esbuild's pipeline, supports both regular and literate CoffeeScript, offers configurable options (bare, inlineMap), and is designed for Node.js environments. Ships TypeScript type definitions for a better development experience.
npm install esbuild-coffeescriptVerified import paths — ran on the pinned version, not inferred.
Shows basic usage: import the plugin, pass it as an esbuild plugin, and bundle a CoffeeScript entry point.
Upgrade to Node.js >=20 and use import syntax instead of require().
Set bare: false explicitly if you need the IIFE wrapper, or adjust your code to expect bare compilation.
Pass all options as the first argument: coffeeScriptPlugin({ bare: true, inlineMap: true }).Set inlineMap: false and rely on esbuild's source map generation instead.
Rename files to .litcoffee or manually configure additional extensions via CoffeeScript's register() function.
Convert your project to ESM (set type: 'module' in package.json) or use dynamic import: import('esbuild-coffeescript').then(m => m.default()).Use import coffeeScriptPlugin from 'esbuild-coffeescript' (default import) instead of import { coffeeScriptPlugin } from 'esbuild-coffeescript'.Run npm install coffeescript@latest to upgrade CoffeeScript to version 2 or later.