{"id":21221,"library":"esbuild-coffeescript","title":"esbuild-coffeescript","description":"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.","status":"active","version":"3.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/johnie/esbuild-coffeescript","tags":["javascript","esbuild","esbuild-coffeescript","esbuild-plugin","coffeescript","litcoffee","typescript"],"install":[{"cmd":"npm install esbuild-coffeescript","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-coffeescript","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-coffeescript","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; core bundler required to run the plugin","package":"esbuild","optional":false}],"imports":[{"note":"The package is ESM-only since v3; CommonJS require() will fail.","wrong":"const coffeeScriptPlugin = require('esbuild-coffeescript')","symbol":"default","correct":"import coffeeScriptPlugin from 'esbuild-coffeescript'"},{"note":"Also available as a named export for consistency with esbuild plugin conventions.","symbol":"coffeeScriptPlugin (named export)","correct":"import { coffeeScriptPlugin } from 'esbuild-coffeescript'"},{"note":"TypeScript users should use type-only imports to avoid bundling runtime code.","wrong":"import { CoffeeScriptOptions } from 'esbuild-coffeescript' (value import will cause runtime error)","symbol":"CoffeeScriptOptions (type)","correct":"import type { CoffeeScriptOptions } from 'esbuild-coffeescript'"}],"quickstart":{"code":"import coffeeScriptPlugin from 'esbuild-coffeescript';\nimport esbuild from 'esbuild';\n\nawait esbuild.build({\n  entryPoints: ['src/main.coffee'],\n  bundle: true,\n  plugins: [coffeeScriptPlugin()],\n  outfile: 'dist/bundle.js',\n});\n\n// main.coffee content:\n// answer = 42\n// console.log(\"the answer is #{answer}\")","lang":"typescript","description":"Shows basic usage: import the plugin, pass it as an esbuild plugin, and bundle a CoffeeScript entry point."},"warnings":[{"fix":"Upgrade to Node.js >=20 and use import syntax instead of require().","message":"v3.0.0 drops Node.js <20 support and removes the CommonJS entry point; the package is now ESM-only.","severity":"breaking","affected_versions":">=2.x <3.0.0"},{"fix":"Set bare: false explicitly if you need the IIFE wrapper, or adjust your code to expect bare compilation.","message":"The bare option default changed from false to true in v2.0.0, potentially breaking builds that relied on the IIFE wrapper.","severity":"breaking","affected_versions":">=1.x <2.0.0"},{"fix":"Pass all options as the first argument: coffeeScriptPlugin({ bare: true, inlineMap: true }).","message":"Passing options via second argument (coffeeScriptPlugin({}, options)) was deprecated in v2.1.0 and removed in v3.0.0.","severity":"deprecated","affected_versions":">=2.1.0 <3.0.0"},{"fix":"Set inlineMap: false and rely on esbuild's source map generation instead.","message":"Source maps from CoffeeScript may not align perfectly with transformed JavaScript; disable inlineMap if you experience mapping issues.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Rename files to .litcoffee or manually configure additional extensions via CoffeeScript's register() function.","message":"The plugin only handles .coffee and .litcoffee files; other CoffeeScript-like extensions (e.g., .coffee.md) are not recognized.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Convert your project to ESM (set type: 'module' in package.json) or use dynamic import: import('esbuild-coffeescript').then(m => m.default()).","cause":"Using require() to import an ESM-only package in a CJS context.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/esbuild-coffeescript/index.js from /path/to/project/build.js not supported."},{"fix":"Use import coffeeScriptPlugin from 'esbuild-coffeescript' (default import) instead of import { coffeeScriptPlugin } from 'esbuild-coffeescript'.","cause":"Incorrect import of the default export, e.g., using named import when default import is required.","error":"TypeError: coffeeScriptPlugin is not a function"},{"fix":"Run npm install coffeescript@latest to upgrade CoffeeScript to version 2 or later.","cause":"The plugin requires CoffeeScript 2.x or higher, but an older version is installed.","error":"Plugin 'esbuild-coffeescript' encountered an error: CoffeeScript version mismatch. Expected >=2.0.0, got 1.12.7"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}